the blog
Back to -Blog

The Sapphire Language

First details...
by Huw Collingbourne
Tuesday 18 March 2008.

Regular readers of this blog may have noticed a few cryptic references to two projects we have underway - one is called Amethyst, the other is called Sapphire. Up to now we’ve been silent on the details of these two projects. The time has come to spill a few beans about Sapphire...

Sapphire is the name of a new programming language. It has a Ruby-like syntax - but much simplified. The overriding design principle of Sapphire is that the language should be consistent, unambiguous and deeply object oriented. In order to achieve this we have removed many constructs from Ruby: whereas Ruby often has many alternative ways of accomplishing the same effect, Sapphire aims to have one way of doing one thing.


See also: Ruby, Sapphire and Amethyst (27th July, 2007)


The syntax of Sapphire is much stricter than that of Ruby. For example, commands (method calls without parenthesis) are not available. A method name without parentheses is not a method-call but a method-reference. Methods can be assigned to variables and passed as arguments. Lambda methods (nameless methods implemented as blocks) are assigned in a similar manner and these are first class objects. A lambda method is always an instance of the Block class and it has the same independent existence as any other type of object.

Our implementation of object orientation is more rigorous than that of Ruby. We have gone back to the fundamental principles of object orientation epitomised by Smalltalk. This means, for example, that encapsulation and data-hiding is enforced. There are a number of ways of breaking encapsulation as a ’side effect’ in Ruby; this is not allowed in Sapphire.

Another important feature is the ability to assert expected types and ranges. If a method can only operate successfully on string arguments, say, and should always return an array, you may specifically assert that the ingoing arguments are strings and the returned value is an array. You may also assert that values fall within specific ranges (for example that an integer must be between 1 and 100). These assertions are not required and type violations may be optionally treated as errors, warnings or may be ignored. So Sapphire does not ‘remove’ duck-typing and it does not demand type declarations. Its type assertions are there as development and debugging tools - aimed at finding and trapping potential bugs as an integral part of program development rather than having to rely solely on testing.

So, in brief, these are the design principles of Sapphire:

- A simple, consistent, unambiguous syntax
- Rigorous object orientation
- Everything (even blocks and methods) are objects
- A high degree of modularity/encapsulation
- Optional object type checking via assertions

We plan to define a clear specification of the Sapphire language and to make this publically available at an early stage. This will begin when we release the ANTLR grammar of the first draft of the Sapphire syntax later this month. Our own implementation of Sapphire will be developed for .NET (running on the Dynamic Language Runtime) and will be supported by a programming environment code-named Amethyst. If other developers are interested in implementing Sapphire for other platforms, we would be very pleased to work with you, so please get in touch!


For a background to the Smalltalk version of Object Orientation, see: Ruby The Smalltalk Way


Note: Sapphire is not intended to complete with Ruby but to complement it. SapphireSteel Software remains completely committed to supporting Ruby and Microsoft’s IronRuby as a primary goal. Moreover, it is our aim to ensure that our implementation of Sapphire is able to cooperate closely with other .NET languages including IronRuby.

Bookmark and Share   Keywords:  DLR  Sapphire
  • The Sapphire Language
    21 March 2008, by Josh Charles

    Is Sapphire going to be a .NET language? Please say yes!

    • The Sapphire Language
      21 March 2008, by Huw Collingbourne

      Yes!

      Well, that is to say, that our implementation of Sapphire will run on the DLR (the Dynamic Language Runtime) for .NET. The language definition, however, does not specify a platform so, in principle, Sapphire could be implemented on other platforms. But we only have plans to implement Sapphire on .NET.

  • Sapphire is already on the way
    18 March 2008
    • Sapphire is already on the way
      18 March 2008, by Huw Collingbourne

      A previous comment brought that to my attention. It’s unfortunate that the same name has been chosen for an unrelated project. We have been talking about our preparations for Sapphire for some time now and for a product to be called ’Sapphire In Steel’ - the first mentuion was, indeed, in the ’About’ section of our original Project Blog in early 2006:

      Sapphire is the name of a programming project currently in development. We shall, at a later date, provide more information on Sapphire In Steel on this site.

      http://sapphiresteel.com/wpblog/about/

  • The Sapphire Language aka Python
    18 March 2008

    “whereas Ruby often has many alternative ways of accomplishing the same effect, Sapphire aims to have one way of doing one thing.”

    Welcome to Python minus tabs =P

    • The Sapphire Language aka Python
      18 March 2008, by Huw Collingbourne

      Don’t think Python. think Smalltalk! :-)

  • Coincidences are fun: The OTHER Sapphire Language
    18 March 2008, by Jörg W Mittag

    Coincidences are fun!

    Three weeks ago, Daniel J Berg also announced a new programming language, also based on Ruby, also named Sapphire.

    jwm

    • Coincidences are fun: The OTHER Sapphire Language
      18 March 2008, by Huw Collingbourne

      An unfortunate coincidence of names. We have been mentioning the Sapphire project since 2006, however ;-)

      best wishes

      Huw

      • Coincidences are fun: The OTHER Sapphire Language
        2 September 2009, by Neil Murphy

        I guess the other guy could call it Emerald, or Cubic-Zirconium or something.

© SapphireSteel Software 2013
aventis pharma mexico about enalapril meleate diclofenac 50 mg accutane without prescription prilosec lowest price buy generic sildisoft omeprazole tablets cheap fincar in mayami information buy armodafinil canada http://www.afriscope.fr/?buy=219568 modalert 100 sildenafil citrate 100mg oral jelly uk canadian pharmacy bupropion information buy flutivate canada http://www.afriscope.fr/?buy=795545 flagyl no prescription price fluticasone aldactone 25 mg azithromycin nexium canada cheap irovel 300 without prescription 80mg lasix simvastatin 20 naltrexone 0.5 mcg about gleevec discount quinine sulphate 325 mg more info buy rasalect antibiotics bactrim in india more info about buy revlimid online online lasix nexium 25 mg http://www.afriscope.fr/?buy=304476 bupropion hcl xenical 120 mg http://www.afriscope.fr/?buy=728290 information buy silagra uk information lipitor generic drug premarin from asia info about suhagra budeprion sr 150 budeprion xl 150 lowest prices on nexium about buy cheap lasix generic femara in canada about buy ciprofloxacin uk buy nuvigil mexico norvasc online buy sustanon usa in india enalapril maleate 2.5 mg information buy cheap urimax ciprofloxacin hci buy zithromax buy lipitor in thailand canada nexium bupropion 100 mg qutipin lowest price