Nim: Allow underscore _ at end of identifiers

Created on 13 Jun 2016  路  4Comments  路  Source: nim-lang/Nim

same topic on forum
http://forum.nim-lang.org/t/525

i'd like to have underscores in variable names at least
and with the latest "implicit self" feature ({.this: self.}) it allows to write code similar to this:
https://github.com/urho3d/Urho3D/blob/master/Source/Urho3D/Scene/Node.cpp#L48

with simple "class variable" access via "classVariable_.something"

Most helpful comment

They are not uglier than something that I cannot even talk about: "var with underscore (not to be confused with the other var without underscore)".

All 4 comments

A separator has nothing to do at the end of an identifier.

maybe.
but virtually every language has trailing underscores
other options to use with implicit self are "m_var" or "mVar" are uglier than "var_"

example:
m_classVar.method =1
mClassVar.method = 1
classVar_.method = 1

They are not uglier than something that I cannot even talk about: "var with underscore (not to be confused with the other var without underscore)".

Massive downvote from me... This would introduce an ugly special case to the way Nim name resolution works for questionable benefits. More weird special cases => more sources for subtle and hard to find bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wizzardx picture wizzardx  路  4Comments

ghost picture ghost  路  4Comments

hlaaftana picture hlaaftana  路  3Comments

SolitudeSF picture SolitudeSF  路  3Comments

zaxebo1 picture zaxebo1  路  4Comments