TropicSapling/triforce

Make variables start with $ (to prevent ambiguity)

Opened this issue · 4 comments

https://www.reddit.com/r/ProgrammingLanguages/comments/ba9l0k/nomsu_a_dynamic_language_with_naturallanguagelike/ekawxte/

function taking $var

Pros:

  • Makes it easier both for the developer and compiler to distinguish between variables and functions.
  • Improved clarity in function definitions as well (easier to see what's matched and what's not)

Cons:

  • More typing (function taking (Type input) vs. function taking (Type $input))
  • Not really a con but it pretty much has the same effect as just doing (var)

Note: Obviously, using $ specifically is not a requirement; any available symbol/keyword could be used.

EDIT: This is probably not a good idea unless it's required for compilation to work.

No because it looks bad, sure it improves clarity but plenty of popular languages don't have it. Super annoying also if you want to write code snippets on mobile or if you want to write code at all.

@mytopdog They don't have it because they work in a very different way. It's clear where variables are there because you're forced to surround all input to functions with (), which is not a requirement in P+.

@TropicSapling I think it would be best just to leave it up to the developers to decide whether to make it clearer or not, assuming you can use $ in variable names if this feature doesn't go through

The $ symbol would not work for this in the current version of the language since it's used for something else.