Notifications
Clear all

[Closed] MXS coding standards: fn vs function

I just want to ask the scripting community about some coding preferences. MXS gives a lot of freedom to find your own style of coding. But it could be better when most of mxs developers follow some standards.

my first poll is about using fn vs function (or anything else: FN, Function, FUNction, fUnCtIoN, etc.)

37 Replies

also it will nice to tell us a reason…

i’m always using ‘fn’. my one and biggest reason – it’s shorter and these two letters are like specially chosen for two hand fast typing.

Since i found that “fn” can replace “function”, i always use it.
Clear to read, fast to write, even for an “AZERTY” keyboard !
Maxscript editor handles color for it as well.

But when i comment, i prefer “function” or “func” to avoid misanderstanding with any “fn” variable. When commenting i take time to describe and choose my words, so i don’t mind writing all words.
Coding is action time: it has to be fast as i got ideas to execute.
Don’t want to waist energy on syntax.

I’m curious to see if “function” would get a great score ?!!

I use “function” exclusively.
Reason for this being that i agree with the newer programming style guides, where acronyms only should be used in special cases ( really long names/words etc… )

I think it makes the code far more readable too
I really don’t think the amount of time saved when typing “fn” vs “function” is of any relevance compared to the rest.

 lo1

That guideline usually refers to variable names, not language keywords.

1 Reply
(@spacefrog)
Joined: 11 months ago

Posts: 0

Of course, but “fn” is a hacky acronym, no need to fall back to that kind of coding when “function” is also available …

I use ‘fn’ since because … I always used it since I remember starting with Maxscript and checking other examples that used ‘fn’. Nowadays I use it because it’s shorter.

many years ago when i started mxs coding (scripting at that moment) i was using ‘function’. using of ‘fn’ was undocumented or was not implemented. in something around 2002-2003 the using of ‘fn’ instead of ‘funstion’ was shown in the mxs help. and i switched to ‘fn’ because… nobody knew that is allowed, and it was looking like – “see! i’m listening modern music, dressing stylish, and reading most recent mxs documentation”

 lo1

You were using fn before it was cool. :arteest:

couple words about shorter and longer… you know that it’s allowed to use ‘track’ in place of ‘controller’, ‘pos’ in place of ‘position’, and ‘mat’ in place of ‘material’. But I almost every time use the long versions.

and it is a quite appropriate question: “Why do you like to save six letters in the word ‘function’ and not want to save extra five letters in the word ‘material’?”

i have different reasons for those cases. for example an answer for question

if [B]isController[/B] node.width.track and isKindOf node.width.track [B]FloatController[/B] do ()

sounds more likely as NO

I don’t think I knew you could write function, and I’m lazy, less typing always please!

I still haven’t understood mapped functions yet.

Page 1 / 4