Skip to content

Unicode dashes as "lisp'ish" alternative to hump and snake notation #2811

@ozra

Description

@ozra

I use this-is-an-identifier all the time in my code-bases (both in LiveScript for JS, and my home brew C++ transpiler). Seeing that Nim has such a magical feature to keep coders happy with thisIsAnIdentifer and this_is_an_identifer unification (world peace! At last!), it's a perfect candidate for introducing dash-delimiting.

The problem some have with it is the ambiguity regarding identifier-dash vs subtraction operator. For us who use it daily, that's a no-brainer - operators are always spaced. In Nim, this can be solved even better: a subtraction op is a subtraction op, the allowed dash in identifiers is instead a specific Unicode rune.

I'm working on this right now, so I do hope it can be a accepted PR when I get it working. Otherwise I'll have to add a transpilation stage, or patch Nim all the time, shudders..

This would cater to lispers, cobolers (if they're not dead), livescripters, htmlers, cssers, url-sluggers, etc. (OK the list got a bit contrived at the end, I'll give you that!)

Personally I can't live with out it.

I'd like some input on the rune to reserve for the purpose. The candidates so far are: and

  • both make it very clear they're not subtraction signs
  • both tie the identifier tightly together, even in non-spaced juxtaposition to subtraction op
  • both are available in all popular mono spaced fonts I've tried in the editor

The only downside is reserving one Unicode-rune to be 'magical' in identifiers like _ and capitals, instead of verbatim, which I find perfectly reasonable. The way I see it, it's the only missing magic in the identifier-delimiter wars...

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions