[Closed] maxscript syntax comparison
Wouldn’t C# be the same as C, with a few very minor exceptions?
Honestly, I don’t know enough to agree that there would only be a few minor exceptions.
So far, the differences I’ve found between C and C# manifest as: no global variables, no boolean type, and declaring an array requires slightly different syntax. Here’s a sneak preview of the next comparison chart:
I was suprised that C# doesn’t allow global variables. However, there are ways around this.
An interesting one to include might be private/public keywords for structs by the way.
I’m not familiar with private/public keywords for structs… yet… I’ve got a lot to learn!
That’s because they are evil!! Or at least they can easily be used incorrectly. Using a public static class gives you globals, in a sense though, as is mentioned in those links.
I’m not familiar with private/public keywords for structs… yet… I’ve got a lot to learn!
If you’re interested in learning more general programming, then Object Oriented Programming might be a good topic. Even for maxscript the concepts of OOP are quite useful, despite limited support for it in the language.
Even for maxscript the concepts of OOP are quite useful, despite limited support for it in the language.
@Pjanssen: Would you expand on what you mean by limited support? Structs are supported in maxscript, which I would equate to classes, which (from my limited experience) forms the backbone for OO programming (using methods and data fields from the data structures). Polymorphism and Inheritance are supported as well. I’d guess I’d just like to know about any OO pitfalls in maxscript before I fall into one.
Also – I updated the chart to include C# and fixed some syntax errors.
And global variables are evil – unless you’re declaring a rollout as a global variable in maxscript, which can be helpful in many circumstances.
Well, you can work with most OOP concepts in maxscript in some way, but for many of them you have to do some tricky things. Like in the inheritance thread you mentioned. Yes it works, but it is not a convenient way of working. Polymorphism is supported because the language is dynamically typed, so it doesn’t really care about which type an instance is. But as a result of this and without a nice way to do inheritance, it is difficult to make full use of it.
Some things improved of course in recent versions, like the private/public keywords, and the onCreate “constructor”.
btw. In your maxscript structures, creating the instance should have parentheses if you’re not setting any fields Otherwise you’ll probably get a static call to GameChar.name.