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

Remove ? from allowed characters in ID, Symbol, Keyword and NamedArgument #49

Closed
zbraniecki opened this issue Jun 29, 2017 · 5 comments
Closed
Milestone

Comments

@zbraniecki
Copy link
Collaborator

The current spec allows for ? character to be present in ID, Keyword, Symbol and NamedArgument.

I believe that this is more confusing then helping anyone and we should not do this.

Examples of things that are allowed by the spec:


[[ ? ]]
? = Value

? = { ? }

? = { ?[?] }

? = { ? =>
        [?] Variant
    }

? = { ?() }

? = { ?(?=0) }

I recognize that characters like - and _ can be called out the same way, but I do see a particular value of being able to use them in ID and function name at least (although I'd prefer to limit that to non-first character)
The ? character is the only one that I see confusing and unnecessary in all identifiers and keywords.

Since the parsers were never updated to handle that, I also believe that it would be an easy change to make.

@Pike , @stasm , @flodolo , @mathjazz - opinions?

@Pike
Copy link
Contributor

Pike commented Jul 10, 2017

sgtm

@mathjazz
Copy link
Contributor

I'm ok, too.

@stasm stasm added the syntax label Jul 11, 2017
@stasm stasm added this to the Syntax 0.4 milestone Jul 11, 2017
@stasm
Copy link
Contributor

stasm commented Jul 11, 2017

I think we should follow what we did in #50 and forbid ? at the beginning of identiifers, and allow it elsewhere. I feel strongly about the benefit of allowing identifiers like really-close-file? as opposed to really-close-file. Same with function names: VOWEL?() reads better to me than IS_VOWEL().

@zbraniecki
Copy link
Collaborator Author

Just for the record: I feel the opposite to @stasm - that ? as a sigil is unnecessary, unfamiliar (not present in CSS, JS, PHP etc.) and on top of things removes a sigil from the scope of potential semantic sigils in the future.
Due to the nature of the sigil, it's likely only going to be present at the end of the variable/id/arg which increases the confusion factor since it can be both.

I also believe that for dont-make-me-think reasons, IS_VOVEL is better than VOVEL?() and really-close-file = Really close file? is better than really-close-file? = Really close file?.

@stasm
Copy link
Contributor

stasm commented Aug 9, 2017

In #51 we made it illegal for an Identifier to start with -, _ or ?. This answers most of the concerns outlined in the OP. I would still like ? to be a valid character at other positions in identifiers. Most languages disallow it because they use ? for ternary ifs or wildcards. We don't have these limitations and can thus follow in the footsteps of Clojure or Ruby.

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

4 participants