fbpx

one dot or two ? - what is recommended ??

More
1 year 11 months ago #1 by Phil Hepburn
one dot or two ? - what is recommended ?? was created 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 :-







Hope that helps you to advise me ;-0)

Best regards,
Phil.
Wales, UK.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #2 by Robert van der Hulst
Replied by Robert van der Hulst on topic one dot or two ? - what is recommended ??
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
System.DateTime.Now.ToString()
from C# to Vulcan/X#.
Many people did not understand that this has to be written in Vulcan as:
System.DateTime.Now:ToString()
They did not understand that the example had 3 different meanings for the Dot (from left to right):
  1. a namespace delimiter
  2. accessing a static property in the DateTime structure
  3. 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
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #3 by Phil Hepburn
Replied by Phil Hepburn on topic one dot or two ? - what is recommended ??
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.

Please Log in or Create an account to join the conversation.