h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
310 stars 23 forks source link

i can't get symbol from root #140

Closed ghost closed 3 years ago

ghost commented 3 years ago

I can't get symbol from root:

$ (symbol addOne (int :n ==> int :r)(n succ @r)) ::
 0
$ ROOT /addOne
(!) <repl>(1,12) [/addOne]: Key 'addOne' is set to a native value that cannot be retrieved.
    <repl>(1,12) in symbol: dget
    <repl>(1,12) in symbol: /addOne

It says "native"

h3rald commented 3 years ago

Uhm it kinda makes sense now, but it should be properly documented and maybe not called "native".

Basically, at present:

Does invoke work? I should check how dget is implemented, I understand this may seem confusing.

ghost commented 3 years ago

I wrote *ROOT/addOne in terminal after declaring addOne symbol (via operator signature) and min interactive shell didn't response. Is this a bug?

h3rald commented 3 years ago

Errrr 😳🙄 maybe?😬

Will have a look...

h3rald commented 3 years ago

This could be nasty.

I tried defining your operator and using it normally... It works as expected, but if I use *ROOT/addOne it gets stuck. It happens both in the shell and even when interpreting a file!

It looks like it's waiting for input, but I suspect there's some sort of recursion going on but I don't know why.

If you enable debug logs it looks like the method gets executed properly but then it never pushes the result to the stack:

image

ghost commented 3 years ago

How could i do operator modifying on defined operator signatures?

h3rald commented 3 years ago

Operators are not sealed by default, you can just overwrite it with another definition or a lambda...

ghost commented 3 years ago

Operators are not sealed by default, you can just overwrite it with another definition or a lambda...

However i couldn't have accessed their essences (quotes).

h3rald commented 3 years ago

Fixed