JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

`"hello" returns "hello" instead of `hello #8

Closed muratg closed 9 years ago

JohnEarnest commented 9 years ago

The parser doesn't currently support quotation marks as part of symbol syntax. Marking this as an "enhancement" and adding it to my todo list.

JohnEarnest commented 9 years ago

Looking into this further, it appears that the official K5 interpreter does not support this quoted symbol syntax:

 `"a long symbol"
ERROR: rank
 `"abc"
ERROR: rank

oK aims to be compatible with K5 wherever possible, so it looks like this syntax will not be implemented.

muratg commented 9 years ago

How about `$"hello"?

JohnEarnest commented 9 years ago

The behavior of $ has changed. Rather than accepting a prototype, as in K4, There are a series of special symbols which can be used as left arguments to perform various conversions:

  `$"foo"
ERROR: type

 `i$"foo bar"
102 111 111 32 98 97 114

 `c$97+!5
"abcde"

As far as I can tell there isn't an equivalent of your example which permits casting a string to a symbol.

muratg commented 9 years ago

Ok (heh), thanks. Looks like K5 is a step down from K2 in some ways which is unfortunate.