Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 28, 2016 Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Are unicode function names not supported in dmd? bool ∩(A, B)(A a, B b){ return intersect(a, b); } Error: character 0x2229 is not a valid token I won't be terribly disappointed if I can't do this, I really just tried it on a whim, but I thought dmd supported unicode. |
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On Sunday, 28 August 2016 at 05:21:03 UTC, Tofu Ninja wrote:
> Are unicode function names not supported in dmd?
> bool ∩(A, B)(A a, B b){
> return intersect(a, b);
> }
> Error: character 0x2229 is not a valid token
>
> I won't be terribly disappointed if I can't do this, I really just tried it on a whim, but I thought dmd supported unicode.
Oddly enough bool π(A, B)(A a, B b) { ... } works just fine.
|
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On 28/08/2016 5:21 PM, Tofu Ninja wrote: > Are unicode function names not supported in dmd? > bool ∩(A, B)(A a, B b){ > return intersect(a, b); > } > Error: character 0x2229 is not a valid token > > I won't be terribly disappointed if I can't do this, I really just tried > it on a whim, but I thought dmd supported unicode. Try Ÿ. The character I have shown above will work as it is an alphabetic[0] character. [0] http://dlang.org/phobos/std_uni.html#.isAlpha |
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On Sunday, 28 August 2016 at 05:21:03 UTC, Tofu Ninja wrote:
> ...
Also visual D seems to recognize its not a valid character and highlights the error which makes me think its known behavior.
|
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Sunday, 28 August 2016 at 05:28:17 UTC, rikki cattermole wrote: > On 28/08/2016 5:21 PM, Tofu Ninja wrote: >> ... > > Try Ÿ. Yeah Ÿ and π both work but ∩ does not. I think I found my answer though... http://dlang.org/spec/lex.html#IdentifierChar > Identifiers start with a letter, _, or universal alpha, and are followed by any number of letters, _, digits, or universal alphas. Universal alphas are as defined in ISO/IEC 9899:1999(E) Appendix D. (This is the C99 Standard.) Identifiers can be arbitrarily long, and are case sensitive. Identifiers starting with __ (two underscores) are reserved. |
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On Sunday, 28 August 2016 at 05:21:03 UTC, Tofu Ninja wrote:
> Are unicode function names not supported in dmd?
Here's a few ANSI characters you can use (and can type with alt-codes):
ª º · Ø ø µ ƒ
I use º pretty often, it makes a nice sigil.
|
August 28, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Cauterite Attachments:
| On Sun, 2016-08-28 at 08:03 +0000, Cauterite via Digitalmars-d-learn wrote: > On Sunday, 28 August 2016 at 05:21:03 UTC, Tofu Ninja wrote: > > > > Are unicode function names not supported in dmd? > > Here's a few ANSI characters you can use (and can type with > alt-codes): > ª º · Ø ø µ ƒ > I use º pretty often, it makes a nice sigil. And if you can't remember the alt-codes (I never can) I use compose keys for the easy stuff ™ © ° and the like and keyboard remapping for the harder stuff θ μ π and the like.. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
August 29, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On Sunday, 28 August 2016 at 05:21:03 UTC, Tofu Ninja wrote:
> Are unicode function names not supported in dmd?
> bool ∩(A, B)(A a, B b){
> return intersect(a, b);
> }
> Error: character 0x2229 is not a valid token
>
Personally, I would prefer 'intersect' as a function name over '∩' anytime.
Which benifits does the symbols add?
|
August 29, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesper Tholstrup | On Monday, 29 August 2016 at 12:53:26 UTC, Jesper Tholstrup wrote: > Personally, I would prefer 'intersect' as a function name over '∩' anytime. > > Which benifits does the symbols add? Sounds like you'd love Java. x = new BigDecimal("0.1") x.negate().divide(y).compareTo(z) who needs symbols? >_> |
August 29, 2016 Re: Unicode function name? ∩ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Cauterite | On Monday, 29 August 2016 at 13:06:17 UTC, Cauterite wrote:
>
> Sounds like you'd love Java.
> x = new BigDecimal("0.1")
> x.negate().divide(y).compareTo(z)
>
> who needs symbols? >_>
Well, I wasn't trying to start a language battle, I like D (which maintains a 'union' keyword;-))
I simply see no need for code obfuscation using, possibly, ambiguous symbols.
Your auto 'start-pointing-fingers' reply did not change that.
|
Copyright © 1999-2021 by the D Language Foundation