{"id":2460,"date":"2016-11-24T19:54:21","date_gmt":"2016-11-24T07:54:21","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=2460"},"modified":"2016-11-25T20:59:23","modified_gmt":"2016-11-25T08:59:23","slug":"the-9th-element","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/2460\/","title":{"rendered":"The 9th Element"},"content":{"rendered":"<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">5<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>In the periodic table of the elements, at #9 we find <em>Fluorine<\/em>.  Curiously though the name &#8220;<em>Fluorine<\/em>&#8221; is not used (that I am aware of) anywhere in the <strong>Elements 9.0<\/strong> release which dropped this week.  But there is <strong>plenty<\/strong> of interest in this release, aside from Period Table curios.<\/p>\n<p><!--more--><\/p>\n<p>I&#8217;m busy working an <em>ASP.NET MVC\/WebApi<\/em> Azure project (using <strong>Oxygene<\/strong>) for which I am using one of the more recent 8.x beta&#8217;s and haven&#8217;t had chance to look at 9.0 in detail specifically yet so I shan&#8217;t be covering <em>everything<\/em>.  Some of the features have been in the recent beta&#8217;s &#8211; in some cases for some time &#8211; so I can talk about those with some experience to relate to.<\/p>\n<p>For detailed coverage of every aspect of this new release you can of course <a href=\"http:\/\/blogs.remobjects.com\/2016\/11\/22\/announcing-elements-9\/\">go to the source<\/a> but in the meantime here&#8217;s my whistle-stop tour of the key highlights.<\/p>\n<h2> Island <\/h2>\n<p>If you aren&#8217;t already aware, the <strong>Elements<\/strong> compiler stack is a sophisticated beast with different &#8220;<em>front-ends<\/em>&#8221; (the source languages you write your code in) all paired to the same team of &#8220;<em>back-ends<\/em>&#8221; (the target platforms your source code can be compiled, natively, to run on).<\/p>\n<p><strong>Island<\/strong> is a new back-end.  In fact, it is apparently going to become a <em>collection<\/em> of back-ends, with two platforms incorporated thus far and potentially more to come.  The two supported as of <strong>Elements 9.0<\/strong> are:<\/p>\n<ul>\n<li>Win32 (incl. Win64)<\/li>\n<li>Linux<\/li>\n<\/ul>\n<p>That&#8217;s right.  As well as the long-standing support for the .NET platform for Windows, the <strong>Elements<\/strong> compiler can now produce <em>Win32\/Win64 native x86 executables developed directly against the Win32 API&#8217;s<\/em>.<\/p>\n<p>I have yet to look at the Win32 support in depth, and Linux is not an area I have any exposure to so am unable to provide detailed commentary on that score.  But this raises some tantalising prospects as I am sure are already perhaps beginning to occur to some.<\/p>\n<p>Somewhat related is the introduction of a Delphi compatibility library (although this is still a work in progress, <a href=\"https:\/\/docs.elementscompiler.com\/Platforms\/Island\/\">as mentioned in the wiki<\/a>).  The <strong>Oxygene<\/strong> compiler has always had some limited support for Delphi specific language foibles such as different keywords for <strong>function<\/strong>s and <strong>procedure<\/strong>s (rather than simply <strong>method<\/strong>s which either do or do not have return values).  But since development occurs in the context of the specific target platforms involved, Delphi compatibility at that level has been something you mostly had to put in place for yourself, if you wished.<\/p>\n<p>The new Delphi compatibility library intends to address that.  Whether you choose to use it of course is still up to you.  \ud83d\ude42<\/p>\n<p>But back to the native Win32 platform support, remember this isn&#8217;t limited to just <strong>ObjectPascal<\/strong> development using <strong>Oxygene<\/strong> but also extends to the <strong>C#<\/strong> and <strong>Swift<\/strong> front-ends also (and if polyglot programming is your thing, there&#8217;s no reason to not mix and match as you see fit).<\/p>\n<p>Develop x86 native Windows applications (or .NET or Java\/Android for that matter) using Swift ?  I wonder if Apple ever had that in mind ?  \ud83d\ude42<\/p>\n<p>Speaking of the language front-ends, Elements 9 also introduces (in &#8220;<em>coming soon<\/em>&#8221; form at this stage), <b>Iodine<\/b>.<\/p>\n<h2>Iodine<\/h2>\n<p>This is the name for <strong>RemObjects<\/strong> implementation of <strong>Java<\/strong>.  That&#8217;s <strong>Java<\/strong> <i>the language<\/i>, as distinct from (the well established and proven support for) <strong>Java<\/strong> <i>the platform<\/i>, with their existing front-end languages.<\/p>\n<p>Although not part of the initial release version of <strong>Elements 9<\/strong>, <a href=\"https:\/\/docs.elementscompiler.com\/Iodine\/\">Iodine is already in beta<\/a> and so is available to all current subscribers (no limited access beta programs with RemObjects).<\/p>\n<h2>Oxygene Continues to Evolve<\/h2>\n<p>With all this development of new back-ends and front-ends, you might be forgiven for expecting there to have been little development on the existing components in the stack.<\/p>\n<p>Nothing could be further from the truth, as Oxygene continues to evolve and develop as a language.<\/p>\n<p>One thing that I was initially skeptical of was the introduction of <strong>Unified Class Syntax<\/strong>.  The name of the feature is not especially descriptive imho since the feature operates at the level of a unit, not a class specifically, although classes <em>in<\/em> units are of course the most affected.  So I&#8217;ll just call it <strong>Unified Syntax<\/strong> (which will also save me some typing).<\/p>\n<p>In a nutshell, <strong>Unified Syntax<\/strong> eliminates the use of separate <strong>interface<\/strong> and <strong>implementation<\/strong> sections in a unit, essentially making things much more C#-like.<\/p>\n<p>Sometimes I think this is a step backward.  With classes with more than a handful of methods, having that &#8220;table of contents&#8221; in the interface section makes living with the code in the longer term far more comfortable.  Changes that introduce or remove methods are more readily apparent when doing diff&#8217;s etc, as these are reflected in that table of contents very visibly, as well as being often buried (or at least not so clearly identifiable) in the (sometimes large) chunks of changes going on down in the implementation section.<\/p>\n<p>But, all that structure is undeniably cumbersome when it comes to things like a <strong>POCO<\/strong> (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Plain_Old_CLR_Object\">Plain-Ol&#8217; CLR Objects<\/a>).  Or, if you are implementing a simple class which overrides a method or two and adds some properties, such as extending an ASP.NET IdentityContext class.<\/p>\n<p>With <strong>Unified Syntax<\/strong> these become -(<em>dare I say it ?  Yes I think I dare&#8230;<\/em>)- quite <em>beautiful<\/em>.  \ud83d\ude42<\/p>\n<p>Example of a POCO:<\/p>\n<pre class=\"brush: oxygene; title: ; notranslate\" title=\"\">\r\n\r\nnamespace MyProject.ViewModels;\r\n\r\n  type\r\n    Person = public class\r\n      property Id: String;\r\n      property FirstName: String;\r\n      property LastName: String;\r\n      property DateOfBirth: DateTime;\r\n    end;\r\n\r\nend.\r\n\r\n<\/pre>\n<p>The removal of <strong>interface<\/strong> and <strong>implementation<\/strong> in these cases doesn&#8217;t exactly shake the Earth to its core, but for me at least this is a case of not realising quite how much noise there was until it was gone.  Like when the air-conditioning goes off when you stay late in the office.  You were glad it was keeping you warm\/cool during the day but sometimes that unexpected extra peace and quiet you didn&#8217;t realise was possible is a surprisingly welcome relief.<\/p>\n<p>Now for something where the changes are more significant:  A class with a trivial overridden <strong>ctor<\/strong> as well as some additional properties:<\/p>\n<pre class=\"brush: oxygene; title: ; notranslate\" title=\"\">\r\n\r\nnamespace MyProject.Repository;\r\n\r\n  uses\r\n    Microsoft.AspNet.Identity.EntityFramework,\r\n    MyProject.Models;\r\n\r\n\r\n  type\r\n    MyDbContext = public class(IdentityContext&lt;IdentityUser&gt;)\r\n\r\n      property Customers: DBSet&lt;Customer&gt;;\r\n\r\n      constructor;\r\n      begin\r\n        inherited(&quot;name=MyConnectionString&quot;);\r\n      end;\r\n\r\n    end;\r\n\r\nend.\r\n\r\n<\/pre>\n<p>As I say, I was initially skeptical about <strong>Unified Syntax<\/strong> but the great thing is that the compiler seamlessly adapts to whichever style you have adopted in each unit.  There are no compiler switches or directives to contend with, you simply choose whether to use <strong>interface<\/strong> and <strong>implementation<\/strong> sections in your unit or not, according to which you are most comfortable with either in that particular case or generally.<\/p>\n<p><del>The only thing you cannot do is mix and match in the same unit.  That is, you cannot have <strong>interface<\/strong>\/<strong>implementation<\/strong> sections <em>and<\/em> then go ahead and implement a method in the <strong>interface<\/strong> section.<\/del><\/p>\n<p><del>Essentially, I suppose, the presence (or absence) of the <strong>interface<\/strong> keyword itself (immediately following the <strong>namespace<\/strong> declaration) is the switch\/directive, if you want to think of it like that.<\/del><\/p>\n<p><strong>Correction:<\/strong>  <em>You can even mix and match styles<\/em>.<\/p>\n<p>To have the ability to mix-and-match the one pre-requisite is that your unit has <strong>interface <\/strong>and <strong>implementation<\/strong> sections.  That being the case, you can then choose (on a method-by-method basis, if you wish) to inline a method implementation in the class declaration, or simply declare a method and then provide the implementation in, well, the <strong>implementation<\/strong> section.<\/p>\n<p>You might for example choose to inline trivial methods (one-liner cases) whilst separating more complex method bodies into the <strong>implementation <\/strong>section.  Or you might have two (or more) classes in the unit and wish to use <strong>Unified Syntax<\/strong> for some but not others.<\/p>\n<p>For some reason I had thought this wasn&#8217;t possible (or perhaps just not desirable) but ran into a situation where it would be useful and tried it.  I&#8217;ll provide details of that scenario in a follow-up post.<\/p>\n<p>Likewise I shall try to find time to post on more of the new features in Elements 9.0 as they occur to me and\/or I gain familiarity with them.<\/p>\n<p>For now I must back to that ASP.NET project (which should provide some blog-able material itself shortly).<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">5<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span> In the periodic table of the elements, at #9 we find Fluorine. Curiously though the name &#8220;Fluorine&#8221; is not used (that I am aware of) anywhere in the Elements 9.0 release which dropped this week. But there is plenty of interest in this release, aside from Period Table curios.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[205,4,242,300,204,285],"tags":[273,305,304,181,303,302],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-DG","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2440,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2440\/","url_meta":{"origin":2460,"position":0},"title":"Fantasy Island [a.k.a x86\/x64 Codegen Using Oxygene]","date":"22 May 2016","format":false,"excerpt":"This is a quick follow up post to further tease some of the exciting developments in the world of RemObjects Elements. Yesterday I posted about implementing a Windows version of my trivially simple RandomNumber application. Today, I present another Windows version. But this one doesn't use .NET. First of all,\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2537,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2537\/","url_meta":{"origin":2460,"position":1},"title":"Delphi for Linux: Enterprise \/ Architect Only + ARC Imposed = &#8230; ?","date":"13 Feb 2017","format":false,"excerpt":"With the lack of any easily available information from Embarcadero, in yesterday's post I had to speculate as to the cost that might be involved with the new Delphi for Linux. According to comments it seems that I was being overly generous by suggesting that only a Pro Edition of\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/amnesty.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2265,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2265\/","url_meta":{"origin":2460,"position":2},"title":"Nullable Types.  Not!","date":"23 Aug 2014","format":false,"excerpt":"I recently mentioned that RemObjects have placed their OS X native IDE - a.k.a. Fire - into public beta. I haven't been using it myself (yet) but have been following developments in the RemObjects Talk forums with interest, and a new feature in the Elements 8.0 compiler (also part of\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2252,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2252\/","url_meta":{"origin":2460,"position":3},"title":"Making a Noise About on a Thread","date":"13 Aug 2014","format":false,"excerpt":"I'm working on an Android app at the moment, and for a bit of fun I decided to add a startup sound to brighten the day of every user that launches it. Which gives me another opportunity to present some of the advanced language features in Oxygene that make threading\u2026","rel":"","context":"In &quot;Android&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Audio-Resource.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2433,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2433\/","url_meta":{"origin":2460,"position":4},"title":"Fire, Walk With Me","date":"21 May 2016","format":false,"excerpt":"This final post in the mini-series re-creating a random number app for OS X, Android and .NET has taken a while not because it's complicated but because I've been distracted by a far more significant cross-platform project and some significant and exciting developments in the world of Fire and Elements.\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2296,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2296\/","url_meta":{"origin":2460,"position":5},"title":"Sign Here Please&#8230; (Using This Specific Pen)","date":"01 Sep 2014","format":false,"excerpt":"My original Android version of TXT-2-PARK has been in the Google Play Store for a little over a week now. But it was only on Saturday that I decided to install the release version onto my phone from the store itself, and found a problem. The application would download just\u2026","rel":"","context":"In &quot;Android&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2460"}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=2460"}],"version-history":[{"count":10,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2460\/revisions"}],"predecessor-version":[{"id":2477,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2460\/revisions\/2477"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=2460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=2460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=2460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}