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

Characters without meaning should be interpreted as strings #15

Open
vihanb opened this issue Dec 29, 2015 · 2 comments
Open

Characters without meaning should be interpreted as strings #15

vihanb opened this issue Dec 29, 2015 · 2 comments

Comments

@vihanb
Copy link
Contributor

vihanb commented Dec 29, 2015

This is more of a feature-request but my idea is: characters that would throw a syntax error, should be converted to strings:

*+UqR 
"*"+UqR

Like in this example, the * operator would never at the very start of a program so it can be considered a string.


Another example, this time with emojis

U===🦄
U==="🦄"

because I can't imagine a case where a unicorn would be in the middle of a program

@ETHproductions
Copy link
Owner

Hmm, that's a pretty good idea, but idk how easy it would be to pull off. Remember that one of +-*%&|^ etc. after a lowercase letter already transpiles to a function. I guess we could just say if the previous character is non-existent, a semicolon, a curly or square bracket, or another operator, change it to a string. (The last one requires the current char to not be + or -.)

Also, LOL at your second example ;)

@ETHproductions
Copy link
Owner

This has been done partially done, if only for another reason; I found that the easiest way to make auto-functions (e.g. mp2, map by using .p(2) on each item) shorter to use was to transpile the first char(s) to a string, then let the function decide what to do with it. So now you can use a lowercase letter or operator as the first argument in a function and it will interpret it as a single-char string. See here for example usage

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

No branches or pull requests

2 participants