Stupid Trick That Works

I’m a bit scared (but enormously amused at the same time) to say that this bit below compiles without error. Debugging is a festival of color and confusion, though :smiley:

:slight_smile:

Yeah, that’s amusing like seeing a clown wielding a butcher knife. :slight_smile:

Oh, come on. It’s just a funny after effect of supporting unicode, similar to this fun bit from 1992 (can’t go earlier than this experimenting with UTF-8!) :smiley:

https://plus.google.com/101960720994009339267/posts/Snbs1Mr9CEv

I think that’s awesome. I can’t wait to start declaring all my variables as emoticons. :smiley:

I might work this into my XojoWorld presentation. :slight_smile:

[quote=6690:@Eduardo Gutierrez de Oliveira]I’m a bit scared (but enormously amused at the same time) to say that this bit below compiles without error. Debugging is a festival of color and confusion, though :smiley:

[/quote]

Yeah… don’t do this. It will break at some point when the compiler starts checking that names are actually valid Unicode identifiers. Emoji and such will always be valid within string literals though.

I don’t think anyone would do this, as it’s unusable. I just found it funny.

Even so, isn’t emoji considered valid Unicode identifiers? Although at the moment is a proposal it’s probably going to go in in the end.

http://www.unicode.org/~scherer/emoji4unicode/snapshot/utc.html

(I have no interest in emoji, this is pure curiosity)

I believe that this is just a funny side effect of something that is really great, broader support for foreign languages.

Dim ??1? as string= “This is a Chinese variable 1 content”
msgbox ??1?

Dim variaoAtmosfrica as Double = 1.2
Dim pressoAtmosfrica as Double = 65.0
msgbox cStr(variaoAtmosfrica+pressoAtmosfrica)

So, be careful with this thing of “Valid Unicode Identifiers”.
Being funny chars does not make them invalid in a flexible context. :wink:

[quote=6715:@Ricardo Araujo]I believe that this is just a funny side effect of something that is really great, broader support for foreign languages.

Dim ??1? as string= “This is a Chinese variable 1 content”
msgbox ??1?

Dim variaoAtmosfrica as Double = 1.2
Dim pressoAtmosfrica as Double = 65.0
msgbox cStr(variaoAtmosfrica+pressoAtmosfrica)

So, be careful with this thing of “Valid Unicode Identifiers”.
Being funny chars does not make them invalid in a flexible context. ;)[/quote]

Nobody is saying that identifiers will be required to be ASCII. At some point, the compiler will start enforcing that identifiers according to Unicode Standard Annex #31, though perhaps with some tweaks as it’s not something I’ve spent a great deal of time looking into.

I don’t see any problems, except… character case. As basic is a case insensitive language, and there many characters and languages in Unicode.

Xojo could just state that identifiers with pure ASCII chars can follow this rule, all non-ASCII (>=128) will be case sensitive, so:

Dim action1 as integer = 1 // Eng lower
Dim actiON1 as integer = 2 // English upper - ERROR - Name in use

Dim accin1 as integer = 1 // Spanish
Dim acciN1 as integer = 2 // same word, different case, another variable, OK

I did a test. Seems that Xojo already does that. So no problem. :wink:

[quote=6719:@Ricardo Araujo]Dim accin1 as integer = 1 // Spanish
Dim acciN1 as integer = 2 // same word, different case, another variable, OK

I did a test. Seems that Xojo already does that. So no problem. ;)[/quote]

Don’t rely on that either. The language is meant to be case insensitive and the fact that only ASCII characters follow that rule is a bug.

Unicode support for identifiers is nice, as it allows to use foreign characters in method names. Unfortunately, there is a bug that makes them garbled in the Debugger. Submitted for RS2012, still present in Xojo: <https://xojo.com/issue/22263>