Repository navigation
iscon, isstr, isnum, isfloat, ispn, isarray type tests (#447) (4.2.34) - #790
Merged
Merged
Conversation
NLP++ is loosely typed and passing the wrong kind of value often fails silently. Six builtins test a value's kind and return 1 or 0, without warnings even for empty values. A numeric string is a string; an unset variable reads as 0, so it is a num. Compiled analyzers reach them through the builtin bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #447. Follows the review choice of separate
is*builtins.iscon(x)isstr(x)""and digit strings like"42"isnum(x)isfloat(x)ispn(x)isarray(x)0, soisnum(L("unset"))is 1.iscon,ispnand the rest are 0 for it, which is what guards likeif (!iscon(L("c")))need.bridgedFns.Tests:
tests/type-testsruns every builtin on a concept, a string, a digit string, an empty string, an integer, a float, a node, an array and an unset variable, plus direct calls. CI steps run on Windows and Linux.$GITHUB_WORKSPACEand always fails locally.Docs: VisualText/visualtext-files PR follows. Batched: don't tag yet.
🤖 Generated with Claude Code