cdumont writes: > Smylers wrote: > > > cdumont writes: > > > > The given ... when doesn't seem to bring that much from switch ... > > > case given ... > > > > Surely it brings all of it? Plus much more as well. Much of the > > power is in the smart-matching, which enables many different sorts > > of comparisions, each naturally matching the appropriate thing. A > > big advantage given has over C's switch construct is not having to > > include break in the usual case (and get mysterious-yet-silent bugs > > if you accidentally forget it). > > I understand that given ... when is even more powerful than a simple > switch case but why just don't say it this way : this is a switch case > dopped with hyper process
Maybe the documentation will say it that way! > and keep the old switch ... case keywords. But "keeping" the "old" ones would require having them already -- which Perl doesn't. What would be the point in simultaneously introducing a flexible syntax which meets all switching needs and a less-powerful syntax (which is completely different, thereby making it more work than necessary if you outgrow its requirements and need to change to using the more flexible alternative; and which is error-prone)? > I don't know why, this given... when sounds so 'English' without > really being that English. I'm afraid you've lost me -- are you saying that given does sound English or that it doesn't? And why is it relevant either way? > > > And hashes require '=> ' but it could be nice to switch to ':' > > > > Indeed it could be. But, unfortunately, the colon seemed to be top > > of many people's most-wanted lists, with many different (and mutex) > > suggestions for what it should do. (Remember, only a couple of > > paragraphs ago you were wanting to keep it for the ? ... : > > operator!) Possibly somebody could design a language in which the > > colon is the only symbol used ... > > I don't really think using the column in a ternary means that you > cannot use it else where. We started off with that, and it was changed specifically because it was causing a problem; I can't remember exactly what, but it's in this list's archives somewhere. Remember that whatever expression you want to use the colon for is going to be valid between the ? and : parts of the ? ... : operator, and so you need to avoid the colon being confused for the : which marks the end of this part of the ? ... : operator. Also remember that we want Perl 6 to be able to complain about syntax errors -- that is, we want that when somebody makes a typo, there's a good chance of perl complaining about the source being invalid, rather than it being valid Perl 6 (but which silently does something else). > As for the functions, i didn't see that much for hashes and arrays > which was a big disappointment. What were you hoping for? Many things which were functions in Perl 5 are now also available as methods in Perl 6. If you post here with what you're disappointed to be missing, it may be that somebody can reply pointing out where the equivalent functionality is! Smylers