4 ms·
> That the function/method names could be better, I agree. Are you referring to python's choices, ruby's, Perl 6's, or all of them? If you think .WHAT could be
by raiph 11y ago
> That the function/method names could be better, I agree.
Are you referring to python's choices, ruby's, Perl 6's, or all of them? If you think .WHAT could be better, is it the all caps you dislike or is it use of the word 'what' or both? What would you suggest instead?
- logicallee 11y agoto epidemian, yes, it's what I was referring to, sorry I wasn't more clear. raiph: we're talking about perl 6's two choices for the things you've brought up, that it's in all-caps and that it consists of the contextually nonsense word 'what'. The word "what" is one of the most common English words - so the opposite of a better, explicit choice, like type, class, classtype, etc - and doesn't even mean "what-is" if you read it out loud. 3.WHAT doesn't sound like "What 3 is" - it sounds like "3 - I didn't hear you" or if you're being very generous it means "What is 3?" (asking for its value). You asked what I would suggest? If you want to be really cute and grammatical while sounding like a natural language, here is a suggestion. Instead of WHAT my suggestion is the word STYPE, and read it as though the preceding word had an apostrophe at the end: 3.STYPE, thiswindow.STYPE and so forth. (3's type, thiswindow's type, etc). anyway you asked for a suggesiton, there you have it. I woudn't use it myself though.
- kbenson 11y agoI'm sorry, but that seems somewhat arbitrary to me. When I want to know what an object is, it's very obvious to use .WHAT after you've been exposed to it in my opinion. # perl6 -e 'class Person { has $!initials }; my $p = Person.new( :initials<KAB> ); say $p.WHAT' (Person) As for why all capitals, you can just as easily ask Python why double underscores. In the end, it's all language convention (explained here[1]). Denigrating something just because it's different is not a position I think has merit. If down the line we discover that these were bad choices, at least then there will hopefully be some evidence to point to. > The word "what" is one of the most common English words - so the opposite of a better, explicit choice, like type, class, classtype, etc - and doesn't even mean "what-is" if you read it out loud. 3.WHAT doesn't sound like "What 3 is" - it sounds like "3 - I didn't hear you" or if you're being very generous it means "What is 3?" (asking for its value). If you think WHAT in a programming language is likely to be interpreted as "What? I didn't hear you." then I submit that you are using libraries with very poorly named cutesy methods that the author should have really known better than to use if it ends up in in production. Given the context of a programming language, when would you ever need to call a built in metamethod (because it's all caps...) that meant "I didn't hear you" ? Even when "what" is used in the context of "I didn't hear you" it actually is asking for information (to be repeated), and the "I didn't hear you" is the implicit part (otherwise why would you ask for the same thing be said again?). 1: http://doc.perl6.org/language/mop#Metamethods http://doc.perl6.org/language/mop#Metamethods
- raiph 11y ago> the contextually nonsense word 'what'. I don't buy that it's contextually nonsense. I suspect you had a bad reaction to it and have gotten caught up in that initial reaction. I could be wrong about that but your stated perspective is noticeably extreme and unique about a relatively tiny point. > if you're being very generous it means "What is 3?" (asking for its value). I don't think that's being especially generous. But yes, please be generous. :) I don't think it's asking for its value. What is Belgium? (Country) What is HN? (Time Sink) What is `4 -3i` ? (Complex Number). What is $age? (Int) If you want a value you just write something like: say 3; # 3 say $age; # 55 > You asked what I would suggest? Well I intended my comment for epidemian, but OK. :) > If you want to be really cute Perl 6 explicitly incorporates fun but also explicitly avoids "you think that's cute today" mistakes. I like the choice of names for the pseudo method mop macros: what, which, where, who, why, how, etc. But that's partly because: I find them easy to remember as a group; I found them easy to understand once I'd encountered them once; and I've not seen anyone react negatively to any of them the way you have. ---- Anyhoo, I hope you won't let your dislike for the rarely used .WHAT et al to unduly color your view of Perl 6. I don't expect the tutorial that's the topic of this HN to impress anyone but that's because it deliberately sticks to absolute basics. Instead, I urge you to wait until next year, and then take another look; I think you'll see there's a lot to like.
- epidemian 11y agoI was referring to Perl's choice, and yes, mostly because of the all caps. Python's choice i also find quite distasteful, but i understand that users are supposed to use type(thing) instead of thing.__type__, which is usually the case with these magic methods. I personally prefer Ruby's stance of making built-in methods look like normal user-defined ones (no special double underscore or all caps convention or anything like that). But this is a small quibble; i wouldn't ditch an entire language for such a minor thing (i've used Perl and regularly use Python and have found both to be quite pleasant languages to use :)