Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differences between miniscript and Mini Micro #165

Open
badiku opened this issue Jul 17, 2024 · 2 comments
Open

differences between miniscript and Mini Micro #165

badiku opened this issue Jul 17, 2024 · 2 comments

Comments

@badiku
Copy link

badiku commented Jul 17, 2024

hi, how to add prototype to function?

funcRef.a=function()
>>> print "hello"
>>> end function
> (@print)["a"]
Runtime Error: Key Not Found: 'a' not found in map [line 1]
> (@print).a
Runtime Error: Key Not Found: 'a' not found in map [line 1]

but, in Mini Micro, this works:

] funcRef.a=function()
...] print "hello"
...] end function
] (@print)["a"]
hello
] (@print).a
hello

both latest version 1.6.2

and why null +3 is null , 3+null == 3 ?

https://miniscript.org/wiki/Null
Numeric arithmetic with null is null
When null is involved in any numeric expression, the result is null. For example, null + 42 is null.

@Withered-Flower-0422
Copy link

The first problem is a known bug, see in #70 .

The second question:

  1. String has the highest priority. If an expression has strings, the result is a sting. (null + "1" == "1"; 2 + "3" == "23")
  2. Otherwise, MiniScript tends to convert the data type to the same as what it meets first. (null + 3 == null; 3 + null == 3)
  3. Lists and Maps have their own method of calculation.

@juh9870
Copy link

juh9870 commented Jul 17, 2024

@Withered-Flower-0422 The first issue has nothing to do with #70. #70 only happens with (@a.b).c, not (@a).b, and even if it did, ["a"] completely avoids it.

The issue looks like c++ version doesn't allow properly lookup on the funcRef objects, or at least doesn't look up funcRef map for them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants