Closed fleabitdev closed 4 years ago
defm func method mth If verbosity is an issue not sure why defn|defmacro|defclass need de/def in the front.
If verbosity is an issue not sure why defn|defmacro|defclass need de/def in the front.
I think defm or method are good and I agree with @usaccounts on this point
Thanks for the suggestions!
Unlike Rust, GameLisp is too dynamic to detect global definitions automatically. To use Rust's terminology, there's no way to differentiate an "item" from an "expression".
This is the reason for GameLisp's current (rough) naming convention:
thing
, a form which constructs the type thing
(or a class clause which defines a thing
)defthing
, a macro to invoke thing
and bind the result to a global variablelet-thing
, a macro to invoke thing
and bind the result to a local variableWe could potentially shuffle these names around to make-thing
, thing
and let-thing
respectively, but it would introduce several local inconsistencies (I'm not sure how I'd rename the current def
, fn
and macro
forms) while also being inconsistent with other Lisps.
The inconsistent formatting between defthing
and let-thing
does bother me, so I'm happy to take suggestions for alternatives.
I definitely don't want to use def
or let
within class definitions, because class members are neither global nor local variables.
I'll give method
a try and see what it feels like, but for something which is as fundamental and common as fn
, those extra three characters (compared to met
) would be a genuine downside.
mfn
?
Which could be read as method function or member function.
Personally I prefer met
the most.
Thanks for everyone's suggestions! I decided on met
, and implemented the change in 21ccaf0.
I haven't managed to think up a good replacement for field
or const
, so I'll leave them as they are for now.
The alternative meaning of the word
meth
can be distracting. It might also cause trouble with web filters. I think I'd like to change it.My working plan is to simply replace
meth
withmet
:This issue is open for suggestions for alternative names. Some things to bear in mind:
Needs to work well when replacing
meth
,has-meth?
,call-meth
andmeth-name
.Needs to be very short. Most of GameLisp's commonly-used keywords have a length of two to four characters.
let
anddef
are off-limits, since they're used to define local and global variables respectively, and fields/methods are distinct from both of those things.We could potentially rename
field
orconst
at the same time. They're a little too verbose for my taste (an entire five characters!), and it doesn't feel right to define multiple fields with a single destructuringfield
declaration.