the blog

The Sapphire Language: getting and setting instance variables


Please only leave comments relating directly to this article. Do not leave technical questions or general questions.
If you have any technical questions, we request that you join the forum in order to post them: http://www.sapphiresteel.com/forum/

    The Sapphire Language: getting and setting instance variables
    1 April 2008

    There are 41 keywords in Ruby. Also there are about 6 (more depending on how you count them) or so ’psuedo-keywords’ like private, public, attr_read, etc. which are keywords in all but name. While you CAN override them, I’ve never seen any real code do so. But there’s an awful lot of real code out there :)

    Sapphire currently has 35 keywords (including get/set) so we have a good bit less than Ruby.

    In my view, if something behaves like a keyword, it should be a keyword. No ands, ifs or buts. I suspect that the reason Matz didn’t put private, etc, in as keywords is that the Ruby yacc grammar is a real pig to debug and it was easier to define them as methods. The effect is the same in the end.

    My objection to C# keywords is a) there are way too many and b) I really, really dislike having to put upto 5 keywords in front of a method name. Get/set I have no problem with as the syntax is at least clear. Also, accessors are methods - so why not make this fact explicit and obvious?

    Dermot


pre-moderation

This forum is moderated beforehand: your contribution will only appear after being validated by a site administrator.

Any message or comment?
  • (To create paragraphs, you simply leave blank lines.)

Who are you? (optional)

© SapphireSteel Software 2010