www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Unicode function name? =?UTF-8?B?4oip?=

reply Tofu Ninja <joeyemmons yahoo.com> writes:
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.
Aug 27 2016
next sibling parent Tofu Ninja <joeyemmons yahoo.com> writes:
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.
Aug 27 2016
prev sibling next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
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.
Aug 27 2016
parent Tofu Ninja <joeyemmons yahoo.com> writes:
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.
Aug 27 2016
prev sibling next sibling parent Tofu Ninja <joeyemmons yahoo.com> writes:
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.
Aug 27 2016
prev sibling next sibling parent reply Cauterite <cauterite gmail.com> writes:
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.
Aug 28 2016
parent Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
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:
=20
 Are unicode function names not supported in dmd?
=20 Here's a few ANSI characters you can use (and can type with=C2=A0 alt-codes): =C2=AA =C2=BA =C2=B7 =C3=98 =C3=B8 =C2=B5 =C6=92 I use =C2=BA 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 =E2=84=A2 =C2=A9 =C2=B0 and the like and keyboard r= emapping for the harder stuff =CE=B8 =CE=BC =CF=80 and the like.. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 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
Aug 28 2016
prev sibling parent reply Jesper Tholstrup <jesper.tholstrup gmail.com> writes:
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?
Aug 29 2016
next sibling parent reply Cauterite <cauterite gmail.com> writes:
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? >_>
Aug 29 2016
parent Jesper Tholstrup <jesper.tholstrup gmail.com> writes:
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.
Aug 29 2016
prev sibling next sibling parent Tofu Ninja <joeyemmons yahoo.com> writes:
On Monday, 29 August 2016 at 12:53:26 UTC, Jesper Tholstrup wrote:
 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?
I was just trying it to see if it works. But I think the symbol is nice for readability, typing it is another matter.
Sep 05 2016
prev sibling parent reply Illuminati <Joe Masons.com> writes:
On Monday, 29 August 2016 at 12:53:26 UTC, Jesper Tholstrup wrote:
 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?
It's concise and has a very specific meaning. If one is working with mathematical objects and set up correctly then it can be more easily interpreted because it is `inline` with standard mathematical syntax. It's the same reason mathematicians prefer ∩ over intersect. You would prefer it too if you got used to it. The whole point of symbols is to simplify, ∩ is more simple than intersect as the first requires 1 symbol and the second requires 8 symbols.
Sep 05 2016
parent reply Jesper Tholstrup <jesper.tholstrup gmail.com> writes:
On Tuesday, 6 September 2016 at 02:22:50 UTC, Illuminati wrote:
 It's concise and has a very specific meaning.
Well, only if we can agree on what the symbols mean. I'm not sure that every symbol is concise and specific across the fields of mathematics, statistics, and physics. The worst part, however, is our (humans, that is) intrinsic desire to be "clever". There will be an endless incorrect use of symbols, which will render code very difficult to understand Friday afternoon when things break.
 The whole point of symbols is to simplify, ∩ is more simple 
 than intersect as the first requires 1 symbol and the second 
 requires 8 symbols.
I don't buy that argument - fewer symbols is better? If so disagree, its a lot easier to make and a lot harder to catch a ∩ vs ∪ error compared to 'intersect()' vs 'union()' error. How is Unicode normalization handled? It is my impression that certain symbols can be represented in more than one way. I could be wrong...
Sep 06 2016
parent reply Illuminati <Joe Masons.com> writes:
On Tuesday, 6 September 2016 at 13:41:22 UTC, Jesper Tholstrup 
wrote:
 On Tuesday, 6 September 2016 at 02:22:50 UTC, Illuminati wrote:
 It's concise and has a very specific meaning.
Well, only if we can agree on what the symbols mean. I'm not sure that every symbol is concise and specific across the fields of mathematics, statistics, and physics. The worst part, however, is our (humans, that is) intrinsic desire to be "clever". There will be an endless incorrect use of symbols, which will render code very difficult to understand Friday afternoon when things break.
Symbols are inherently meaningless so you are not making sense. Clever is what got humans out the jungle, I think it is a good thing. No need to denigrate it when you benefit from people being clever. Of course, you could argue that staying in the jungle would have been the best thing...
 The whole point of symbols is to simplify, ∩ is more simple 
 than intersect as the first requires 1 symbol and the second 
 requires 8 symbols.
I don't buy that argument - fewer symbols is better? If so disagree, its a lot easier to make and a lot harder to catch a ∩ vs ∪ error compared to 'intersect()' vs 'union()' error. How is Unicode normalization handled? It is my impression that certain symbols can be represented in more than one way. I could be wrong...
Mathematicians don't seem to get confused by symbols. intersect is a symbol. It is no different than ∩ or any other symbol. It is just chicken scratch. There is no inherent meaning in the wavy lines. If you think there is then you are deluding yourself. You have simply memorized what those groups of symbols mean and you are too lazy to memorize what some other symbol means. Once you realize the game you are playing with yourself then it becomes easier to break the bad habit and not get caught up in the nonsense. The reason why ∩ is better than intersect is because it is quicker to see and analyze(due to its "size"). True, it is more ambiguous, as ambiguity depends on size, but at least in this case it has been well established just as π and 1,2,3..., etc. But if you are so concerned about ambiguity then why not intersectsetofarithmeticintegerswithsetofarithmeticintegers? That is far less ambiguous than intersect. My point is, you are playing games. You might not realize it but that is what is going on. If you want to be truthful, it is better to say "I prefer to use my own personal standardized notation that I have already learned since it takes precious time away from my own life.". When do you this, I cannot argue with you, but then you also have to accept that you cannot argue with me(or anyone else). Because what makes sense or works for you might not work for me or someone else. Your argument is exactly analogous to "I don't speak french! Use English you stupid french speaking person, french is for idiots anyways". The tone is irrelevant, the point is acting like one superficial system is better than some other superficial system simply because of perspective/laziness/arrogance/etc. The only issues are that either you are failing to see the systems as superficial or you are failing to see that your own personal center of the universe is not actually the center of the universe. So just be real. The reason you don't like it is because it confuses you. If it didn't, you wouldn't have a problem with it. If you could speak French and English then you, if you were that hypothetical person, wouldn't care what language was used. All I can say is that everyone is confused until they learn something. But don't confuse your confusion with some innate scale of better/worse, it only leads to more confusion. The solution to all confusion is familiarity. Become familiar with your confusion(e.g., using ∩) and it won't be confusing anymore. The reason the mathematical symbols don't phase me is because I spent years using them. In my mind ∩ = intersection of sets(which I have a non-verbal meaning in my own mind on what that means). I see no difference between ∩ and intersect. Hence I am not confused. If someone comes along and uses ∩ to mean what I call union. Then it won't confuse me either. Because I realize they have just relabeled stuff. Sure I have to keep track, but as long as they are logical(consistent) then I'll get used to(familiar) with their system and it won't be a problem. I won't get angry or upset that they are trying to pull the rug out from underneath me. I'll realize that they just speak French and if I want to communicate with them I'll learn French. No big deal, I'll be more enlightened from doing so. Sure it takes some time, but what else do we humans have to do? Everything we do just superficial anyways.
Sep 06 2016
parent reply Jesper Tholstrup <jesper.tholstrup gmail.com> writes:
On Tuesday, 6 September 2016 at 18:46:52 UTC, Illuminati wrote:
 Symbols are inherently meaningless so you are not making sense. 
 Clever is what got humans out the jungle, I think it is a good 
 thing. No need to denigrate it when you benefit from people 
 being clever. Of course, you could argue that staying in the 
 jungle would have been the best thing...
You are somewhat of topic here.
 Mathematicians don't seem to get confused by symbols.
A lot of code is written by non-mathematicians and has to be maintained by non-mathematicians. Mathematicians will be confused when people start using the symbols incorrectly, simply because they try to be clever. Sure, some developers would probably mix up english words like 'intersect' and 'union', but I think that it is less common.
 You have simply memorized what those groups of symbols mean and 
 you are too lazy to memorize what some other symbol means.
Personal... and wrong...
 Once you realize the game you are playing with yourself then it 
 becomes easier to break the bad habit and not get caught up in 
 the nonsense.
Personal... and wrong... My argument goes towards code maintainability and it is still valid.
 The reason why ∩ is better than intersect is because it is 
 quicker to see and analyze(due to its "size"). True, it is more 
 ambiguous, as ambiguity depends on size, but at least in this 
 case it has been well established just as π and 1,2,3..., etc. 
 But if you are so concerned about ambiguity then why not 
 intersectsetofarithmeticintegerswithsetofarithmeticintegers? 
 That is far less ambiguous than intersect.
As long as humans write software I think (personal estimate) that few would call 'intersectsetofarithmeticintegerswithsetofarithmeticintegers' a readable symbol. I suppose that our invention of snake case, camel case, pascal case, ect. lends some support to my claim.
 My point is, you are playing games. You might not realize it 
 but that is what is going on. If you want to be truthful, it is 
 better to say "I prefer to use my own personal standardized 
 notation that I have already learned since it takes precious 
 time away from my own life.".
Personal, again. No real content. You do realize that 'my own personal standardized notation' encompass >99% of all software thus far - right?
 Your argument is exactly analogous to "I don't speak french! 
 Use English you stupid french speaking person, french is for 
 idiots anyways".
I'm not a native English speaker, so I'm not sure that your argument is valid here. I have learned different languages and various diciplines of natural science. I still don't think that methods/functions should contain e.g. math symbols.
 The tone is irrelevant, the point is acting like one 
 superficial system is better than some other superficial system 
 simply because of perspective/laziness/arrogance/etc. The only 
 issues are that either you are failing to see the systems as 
 superficial or you are failing to see that your own personal 
 center of the universe is not actually the center of the 
 universe.
Personal, again... and it could easily be the other way around I think.
 So just be real. The reason you don't like it is because it 
 confuses you.
Personal, again... and not really....
 If it didn't, you wouldn't have a problem with it. If you could 
 speak French and English then you, if you were that 
 hypothetical person, wouldn't care what language was used.
So far of the topic.
  All I can say is that everyone is confused until they learn 
 something. But don't confuse your confusion with some innate 
 scale of better/worse, it only leads to more confusion. The 
 solution to all confusion is familiarity. Become familiar with 
 your confusion(e.g., using ∩) and it won't be confusing anymore.
Personal, again. I'm not really confused (I think).
 The reason the mathematical symbols don't phase me is because I 
 spent years using them. In my mind ∩ = intersection of 
 sets(which I have a non-verbal meaning in my own mind on what 
 that means). I see no difference between ∩ and intersect. Hence 
 I am not confused.
Cool, the *years* of usage really payed off...
 If someone comes along and uses ∩ to mean what I call union. 
 Then it won't confuse me either. Because I realize they have 
 just relabeled stuff.
Okay, thats quite a statement... I would argue that many developers, not you of course, could oversee the incorrect symbol.
 Sure I have to keep track, but as long as they are 
 logical(consistent) then I'll get used to(familiar) with their 
 system and it won't be a problem.
Okay.
 I won't get angry or upset that they are trying to pull the rug 
 out from underneath me. I'll realize that they just speak 
 French and if I want to communicate with them I'll learn 
 French. No big deal, I'll be more enlightened from doing so. 
 Sure it takes some time, but what else do we humans have to do? 
 Everything we do just superficial anyways.
Eh, okay... You will win in terms of their usage, not doubt - lets see how it goes...
Sep 06 2016
parent reply Illuminati <Joe Masons.com> writes:
On Tuesday, 6 September 2016 at 19:58:11 UTC, Jesper Tholstrup 
wrote:
 On Tuesday, 6 September 2016 at 18:46:52 UTC, Illuminati wrote:
 [...]
You are somewhat of topic here.
 [...]
A lot of code is written by non-mathematicians and has to be maintained by non-mathematicians. Mathematicians will be confused when people start using the symbols incorrectly, simply because they try to be clever. Sure, some developers would probably mix up english words like 'intersect' and 'union', but I think that it is less common. [...]
Ok, continue your game.... I see you are quite involved with it.
Sep 06 2016
parent reply Jesper Tholstrup <jesper.tholstrup gmail.com> writes:
On Tuesday, 6 September 2016 at 20:26:01 UTC, Illuminati wrote:

 Ok, continue your game.... I see you are quite involved with it.
For what it's worth I was actually trying to learn something. I apologize if I contributed to sidetracking the discussion.
Sep 07 2016
parent Illuminati <Joe Masons.com> writes:
On Wednesday, 7 September 2016 at 07:39:53 UTC, Jesper Tholstrup 
wrote:
 On Tuesday, 6 September 2016 at 20:26:01 UTC, Illuminati wrote:

 Ok, continue your game.... I see you are quite involved with 
 it.
For what it's worth I was actually trying to learn something. I apologize if I contributed to sidetracking the discussion.
Well, I tried to tell you that you are hung up on the meaning of meaningless things and you said that it was all my personal opinion. Either it is or isn't but simply stating it proves nothing. It's up for you to decide if what I have said is worth pursuing for yourself or not. But surely you would agree that if you believe something has inherent meaning but it actually doesn't that you are creating a whole world of grief for yourself and others? Hence, it is utmost importance to know? All I will say is "Don't confuse the map with the territory". The territory exists without the map, but not vice versa.
Sep 07 2016