one dot or two ? - what is recommended ??

This forum is meant for anything you would like to share with other visitors
Post Reply
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

one dot or two ? - what is recommended ??

Post by Phil Hepburn »

Hi Robert,

Now that I have been coding X# more than researching stuff for Cologne in April, I find myself coding X# WPF/XAML apps in the MVVM pattern, with increasing use of the single dot, and in many places where previously it was a 'MUST' to get it right and have a colon (double dot) - and not a single dot!!

Since the script in XAML for data binding takes a single 'dot' I have slipped into the easy habit of typing a single dot everywhere it seems, except in the becomes equal to ':=' that we xBasers all love ;-0)

Oh! and I currently am placing a double dot after 'self' which seems to be harder to drop as a habit (comes natural after all these years). Just tried it and it fails with a single dot after 'self'. Why is this then?

Have you got any advice on all of this 'dot' stuff, or should I just go with the flow and do as I wish, like, choose ? And how does that affect the eNotes I write for others? Should I be following some kind of an unwritten rule?

Here are some code samples from a compiling and working app :-
Dots1and2_01.jpg
Dots1and2_01.jpg (69.83 KiB) Viewed 278 times
Dots1and2_02.jpg
Dots1and2_02.jpg (130.52 KiB) Viewed 278 times
Dots1and2_03.jpg
Dots1and2_03.jpg (37.79 KiB) Viewed 278 times
Hope that helps you to advise me ;-0)

Best regards,
Phil.
Wales, UK.
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

one dot or two ? - what is recommended ??

Post by robert »

Phil,

The single dot after SELF and SUPER are not allowed in the current build, but this is something that I fixed. That was a small glitch in the Beta 9 (and older) compiler.

We have decided to allow the single dot since that makes converting examples from C# and VB to X# much easier.

I personally liked the difference between the single dot for namespaces/static properties and colon for instance members, but found that many people did not see/understand the difference.

For example, how to translate

Code: Select all

System.DateTime.Now.ToString()

from C# to Vulcan/X#.
Many people did not understand that this has to be written in Vulcan as:

Code: Select all

System.DateTime.Now:ToString()

They did not understand that the example had 3 different meanings for the Dot (from left to right):
[*]
[*]a namespace delimiter
[*]accessing a static property in the DateTime structure
[*]calling a method on an instance of the DateTime structure


With the new syntax you can now also write it in X# like in C#.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

one dot or two ? - what is recommended ??

Post by Phil Hepburn »

Thanks Robert,

I fully understand - AND - look forward to 'self.' as I use it a lot with a double dot at the moment.  'super.' is not so important to me but I will be consistent with both.

Yes, I also agree with you about us understanding the meaning (difference) - BUT - since we will in a C# world, and need samples/examples, then I think it is a great benefit (to many) for us to be able to have both ways.

So to summarise ?  I will just do my thing and use what feels right to me at the time ;-0) For creating my eNotes for "ClickStart" and conferences.
Regards,
Phil.
Post Reply