Re: [svn:perl6-synopsis] r14520 - doc/trunk/design/syn
On Sat, Mar 15, 2008 at 06:09:40PM -0700, [EMAIL PROTECTED] wrote: Author: larry Date: Sat Mar 15 18:09:39 2008 New Revision: 14520 @@ -1367,9 +1367,10 @@ If you need to force inner context to scalar, we now have convenient single-character context specifiers such as + for numbers and ~ for strings: +$x= g(); # scalar context and g() s/and/for/ in this last line, I think. -- I think you look like the Mona Lisa. You always seem to be at a window admiring the landscape that is actually behind you.Herve Le Tellier http://surreal.istic.org/ Habit is a good slave but a poor master. signature.asc Description: Digital signature
Re: Generalizing ?? !!
On Fri, Jun 22, 2007 at 03:40:37PM +0100, Aaron Crane wrote: my $b = 1 0 || 42; # Now $b is 17 s/17/42/ or vice-versa, I think. -- Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon http://surreal.istic.org/ Show, don't tell. signature.asc Description: Digital signature
Re: Web Module (Was: Perl6 new features)
On Fri, Jun 22, 2007 at 02:07:35PM -0400, Chas Owens wrote: On 6/22/07, chromatic [EMAIL PROTECTED] wrote: I also like to proceed from the assumption that the only core modules should be those required to install other modules. Please, god, no. Or at least make two distributions: Bare Perl 6 and Perl 6. Many companies have a Only Core Perl policy. They refuse to install CPAN modules because We don't trust them. Yeah, it is stupid, but as a contractor I have limited ability to fight their ignorance. Sounds like a bare Perl 6 distribution might be just what you need to get them to weaken their restriction to only modules with a good cpanrating or, best of all, evaluate each module according to its merits. Well, actually, I'm not sure that last one would be best, as getting each module evaluating would almost inevitably entail getting five or six high-up people together, none of whom have any interest in you getting your job done, and who probably hate each others' guts, and getting them to commit to some form of responsibility-generating paper- trail. Call me cynical if you like, but I prefer to call it, experienced. -- It must be accepted as a principle that the rifle, effective as it is, cannot replace the effect produced by the speed of the horse, the magnetism of the charge, and the terror of cold steel. -- British Cavalry training manual, 1907 ::: http://surreal.istic.org/ signature.asc Description: Digital signature
Re: propose renaming Hash to Dict
On Fri, Jun 01, 2007 at 11:44:53AM +0200, Thomas Wittek wrote: Larry Wall: Nope. Hash is mostly about meaning, and very little about implementation. Please don't assume that I name things according to Standard Names in Computer Science. I name things in English. Hash is just something that is disordered, which describes the associative array interface rather nicely, distinguishing it from the ordered Array interface. I'm not a native english speaker, but I've never heard or read the word hash outside CS. I suppose that as a non-native English speaker you've never eaten corned beef hash. I quote from Wikipedia: Hash is a mixture of beef (often leftovers of corned beef or roast beef), onions, potatoes, and spices that are mashed together into a coarse, chunky paste, and then cooked, either alone, or with other ingredients. It's a bit of a working-class dish, for using up your leftovers, so not the sort of thing you'd eat as a tourist, but it seems many other countries have the same sort of thing: using your leftovers is a pretty universal need. In colloquial English there's also the expression, to make a hash of something, which means to make a mess of it, to screw up. That said, the dish and the idiom are both dying out, and the current generation of school leavers might not have heard of either. I didn't make the connection until Larry described it as being disordered. As a general point, I think it's pretty easy to make a mental distinction between a 5ish hash and a hashtable, just as it's easy to remember that 5's abstracted lists and arrays aren't the same concepts as linked lists and C-style concrete arrays. -- It must be accepted as a principle that the rifle, effective as it is, cannot replace the effect produced by the speed of the horse, the magnetism of the charge, and the terror of cold steel. -- British Cavalry training manual, 1907 ::: http://surreal.istic.org/ signature.asc Description: Digital signature
Re: propose renaming Hash to Dict
On Fri, Jun 01, 2007 at 10:30:08AM -0400, John Macdonald wrote: ...make a hash of things (meaning, a mess) corned beef hash That's two people that have given the same list, but both have omitted the more common (in modern times) phrase hash browned potatos which is a hash of chopped potato, onion, and sometimetimes other things fried brown. Well, I have eaten hash browns on many occasions, but in my mind they just don't have the same association with a disordered mess, as they are served as discrete units rather than a mass. But let's stop talking about food now. -- There once was a teacher of great renown, Gather your goods Whose words were like the tablets of stone,and follow me Because it's easier to learn than unlearn, Or you will surely die. Because we've passed the point of no return. Paul Simon, 'The Teacher' signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r14409 - doc/trunk/design/syn
On Wed, May 30, 2007 at 09:13:36AM -0700, [EMAIL PROTECTED] wrote: +the hash, the return value need not be recalculated. If you use +this trait, the compiler will assume two things: + +=over + +=item * + +A given CCapture would always calculate the same return value. That is, +there is no state hidden within the dynamic scope of the call. + +=item * + +The cache lookup is likely to be more efficient than recalculating +the value in at least some cases, because either most uncached calls +would be slower (and reduce throughput), or you're trying to avoid a +significant number of pathological cases that are unacceptably slow +(and increase latency). It seems to me that the first item is only half an item: the compiler also has to assume that evaluating the function has no side effects, or at least is idempotent in that the side effects only happen the first time you call it on a given Capture. Actually, that distinction raises another point in my mind: will there be a way to distinguish pure functions with no side-effects at all, which if called on constants are candidates for being hoisted into BEGIN blocks, from merely idempotent subs, which must not be called until runtime but can be memoized? Even if there is such a distinction, and it is covered elsewhere (reading Synopsis diffs spaghettifies them in my mind, I'm afraid), I think the difference should be mentioned here. -- I think you look like the Mona Lisa. You always seem to be at a window admiring the landscape that is actually behind you.Herve Le Tellier http://surreal.istic.org/Why did you resign? signature.asc Description: Digital signature
Re: explicit line termination with ;: why?
On Tue, May 15, 2007 at 01:14:44PM -0600, Luke Palmer wrote: However, I do think that it's useful to be able to treat the rest of the current scope as a block (usually with a parameter), for certain kinds of closure-heavy code. Maybe this is a case for one of Mr. Lang's custom semicolons with added functionality: you could have something that worked a bit like the lambda-calculus .. It would slurp up as much of the RHS as possible, which would almost always[1] be until the end of the enclosing block, and 'return' it (in a syntactic way) to whatever on the LHS wants a block. So, like Mr. Palmer's example, you would get something like sub do_stuff() { my @foo = get_me_a_list; for @foo :- .subst(/bar/,'baz').say; } [1] By almost always I mean I can't think of a reason for it to sometimes not be that, but one or more may exist. Anywhere you would want it to stop before the end of the enclosing block you should probably use curlies anyway to stop it being confusing. I'm not sure whether I would use these magic brace-opening semicolons even if they were in. It seems to be to be less readable, but maybe that's just because I haven't seen a compelling enough example. In the worst case they would lead to code that looks like the old-style TeX idiom of normal {\bf bold} normal, where you open braces around the whole block and do a state-change-like thing inside rather than a functional thing that takes the thing you want operated on as an argument. That doesn't mean we shouldn't allow custom semicolons with added functionality; just that maybe this is not the best use for them after all. -- Mary had a little sprout,From week to week, from month to month, Its fleece was green as grass, She kept the sprout in tow, She hitched it to a bit of string,And everywhere that Mary went, The silly little ass. The sprout was sure to go. signature.asc Description: Digital signature
Re: explicit line termination with ;: why?
On Mon, May 14, 2007 at 02:29:11PM -0700, Jonathan Lang wrote: 2. This brings up the possibility of custom-designed termination operators. cf. Semi::Semicolons. I think that being flexible enough that people can write packages like that is one of Perl 6's greatest strengths. Long may it continue. Of course, if Perl 6 is actually parsed using a descendant of Larry's 'Perl 6 grammar as a Perl 6 grammar', the compiler could easily (*cough*) provide hooks to edit the grammar at parse-time, meaning you can write your own (lexically scoped) Semi::Semicolons, or Semi::Line::Continuation::Markers, or even Semi::I::Don't::Really::Want::Prefix::Operators::Available::As::Methods. Then there need be no arguments about what it looks like, and everyone will be happy, and all programmers will hold hands and stop having holy wars. Maybe. -- Sometimes it's a Boat, and sometimes it's more of an Accident. It all Depends on what? depends. On whether I'm on the top of it or underneath it. -- A. A. Milne, 'Winnie-the-Pooh' http://surreal.istic.org/ signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r14386 - doc/trunk/design/syn
On Fri, Apr 27, 2007 at 05:08:49PM -0700, [EMAIL PROTECTED] wrote: Author: larry Date: Fri Apr 27 17:08:44 2007 New Revision: 14386 +The final C:: is required here, because the CFoo::Bar{...} syntax +is reserved for defining an autovivifiable protoobject along with +it's initialization closure (see S12). + it's should read its here, unless you are a greengrocer. -- Sometimes it's a Boat, and sometimes it's more of an Accident. It all Depends on what? depends. On whether I'm on the top of it or underneath it. -- A. A. Milne, 'Winnie-the-Pooh' http://surreal.istic.org/ signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r14335 - doc/trunk/design/syn
On Sun, Mar 11, 2007 at 02:17:25PM -0700, [EMAIL PROTECTED] wrote: Author: audreyt Date: Sun Mar 11 14:17:24 2007 New Revision: 14335 Modified: doc/trunk/design/syn/S06.pod == --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Sun Mar 11 14:17:24 2007 @@ -59,20 +59,29 @@ BPrototypes (keyword: Cproto) specify the commonalities (such +COnly (keyword: Conly) routines do not share its short name To match the formatting of the other paragraphs, should this one open BOnly (keyword: Conly) ... That is, the first word is Bold rather than Code. -- I tried snorting coke once, but the bubbles went right up my nose and I knocked the glass over. -- 'Sordid Confessions of a Teenage Innocent' http://surreal.istic.org/ My Very Efficient Memory Just Stores Up Nine signature.asc Description: Digital signature
resumable exceptions and LEAVE/KEEP/UNDO blocks
What happens if a resumable exception is propagated through a block with a LEAVE, KEEP, or UNDO block? S04 seems to be a bit vague on this point. It strikes me that what we want it to do is not execute them when the exception is propagated, because we don't know whether it's going to be resumed or not. If the exception is resumed by its handler, then that's fine, as we can call the blocks at the usual time (when the blocks they are attached to exit). If the exception is caught and handled and not resumed, that would leave us with having to find all the LEAVE c. blocks and call them in the right order when the exception handler exits. In either case, it looks like you have a problem. LEAVE c. blocks will often be used for things like database transactions, where we want to ensure that some lock obtained on entering the block is released promptly regardless of how the control flow jumps about. In such a context, throwing a resumable exception that skips the LEAVE block, farts about doing some potentially long computation in a higher-up scope, and only calls the LEAVE block to release the lock at some later date, seems to be far from the best choice. Sure, we can warn programmers to make their resumable-exception handlers short, or to only throw non-resumable exceptions from blocks that are likely to be called in such circumstances. I suppose that would be an acceptable resolution, but it has an aura of non--re-entrant signal handlers about it, so it seems like the sort of thing I would like to avoid if anyone is clever enough to think of something else to do. BTW, if one is handling a resumable exception, how does one resume it? I couldn't find anything explaining how. Having a .resume method (or some cutesier name) on the Resumable role would seem to make sense. -- Customer Waiter, waiter! There's a fly in my soup! Waiter That's not a bug, it's a feature. http://surreal.istic.org/ The Answer of the Oracle Is Always Death. signature.asc Description: Digital signature
Re: resumable exceptions and LEAVE/KEEP/UNDO blocks
On Mon, Mar 05, 2007 at 09:01:13AM -0800, Larry Wall wrote: I don't see a problem here. I think you maybe missed the bit that says: A CCATCH block sees the lexical scope in which it was defined, but its caller is the dynamic location that threw the exception. That is, the stack is not unwound until some exception handler chooses to unwind it by handling the exception in question. Yes, I did. I was grepping specifically for the bit on resumable exceptions and the quoted bit is 80 lines up so I missed it completely. Thanks for pointing me at it. [...] To resume a resumable exception the correct thing to do is very likely nothing. The outermost warning handler is what generally resumes otherwise uncaught resumables. If you catch a warning, it defaults to resuming when handled unless you rethrow it as fatal. OK, that makes sense. The reason that came up was because on Friday I had a good idea for a language feature that would have made a task I had been doing that day much easier. When I checked the spec, though, I found out it was already in. This is happening increasingly often, which should be reassuring to all concerned. -- Listen to your users, but ignore what they say. - Nathaniel Borenstein http://surreal.istic.org/ Calm down, it's only ones and zeroes. signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r13580 - doc/trunk/design/syn
+This is particularly useful for establishing grammatical categories +in a grammar be declaring a Cproto Ctoken or Crule. (Perl 6's +grammar does this, for instance.) Unless you be a pirate, you may want to revise the above, and add commas. -- Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon http://surreal.istic.org/ They knew about the decepticons. signature.asc Description: Digital signature
Re: Synposis 26 - Documentation [alpha draft]
I liked it. Just one nit, near the end: You can also preconfigure Lformatting codes|#Formatting codes, by naming them with a pair of angles as a suffix. For example: =comment Always allow E codes in any (implicit or explicit) V code... =config V :allowE =comment All code to be italiciized... ^^ =config C :formattedI Note that, even though the code is named using single-angles, the preconfiguration applies regardless of the actual delimiters used on subsequent instances of the code. s/italiciized/italicized/ in the marked place. -- Customer Waiter, waiter! There's a fly in my soup! Waiter That's not a bug, it's a feature. http://surreal.istic.org/ It sounded right in my head.
Re: renaming grep to where
names they're given. The Beatles probably sounded like a really dumb name for a band once. But maybe less dumb than 'The Quarrymen', which was the original name of the band. (They all went to Quarry Bank school, now Calderstones.) Perhaps the renaming, unfettered by their history or by a desire to not fix what ain't broken, helped them along their way to superstardom. I'm not sure if there is a lesson to be learned here. As I haven't previously spoken on the subject, I'll weigh in to express a slight preference for the name grep, though I like Larry's idea of a generalised 'divvy'. Last year, teaching ML, I taught the definition of the 'filter' function as 'grep', simply because I'd forgotten that it was called 'filter' in ML. Mind you, as it had been a year or two since I'd last used ML, I'd also forgotten a few of the other keywords, a problem I have with other languages too. Do you 'throw' or 'raise' an exception? Do you use 'else if', 'elseif', 'elsif', or 'elif'? I can see how aliases can be a Bad Thing, but when my mind is elsewhere I would appreciate some loan words from other languages. -- And for mile after mile you'll never see me tire/You'll never me me slow down for a while/'Cause I am the fox, like it or not/I'm always gonna be there running over the rock/ Yes I am the fox, a fascinating cross/ Of sharp as a whip and tough as an ox Bernie Taupin, 'The Fox' pgpZ9WSwhrmmN.pgp Description: PGP signature
Re: Trying to make a new operator
What am I doing wrong? Sounds like you need to define (or at least declare) the new operator before you use it. Perl 6, like Perl 5 compiles with a single pass, so when you are using your random operator, it hasn't yet read the declaration further down the file. It does its best to DTRT with most functions, but when you're defining arbitrarily random operators, it can only be so clever. -- Sufficiently advanced humour is indistinguishable from tedium. corollary: Humour distinguishable from tedium is insufficiently advanced. http://surreal.istic.org/ Hack code until it works, then stop. pgptQIbTaHijD.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r11975 - doc/trunk/design/syn
svn log, speaking on larry's behalf (): +The string concatenating form is: + +a b X~X 1 2 # 'a1', 'a2', 'b1', 'b2' + +The CX~X operator desugars to something like: + +[~]�( a b X 1 2 ) # 'a1', 'a2', 'b1', 'b2' ^ If the CX variant already concatenates strings, why is it done explicitly in the desugaring of CX~X? Probably not what you intended. I think it's just that the change is incomplete. It looks like the X I've marked should have been changed to a XX. -- Of all things, good sense is the most fairly distributed: everyone thinks he is so well supplied with it that even those who are the hardest to satisfy in every other respect never desire more of it than they already have. -- Descartes, 1637 http://surreal.istic.org/ pgpLyimbePuE8.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r11971 - doc/trunk/design/syn
+Note that only the first term of an CX operator may reasonably be +an infinite list. Now all we need is a variant that does the diagonal order and we'll be home and dry. 'a'..* diagX 1..* - ['a', 1], ['a', 2], ['b', 1], ['a', 3], ['b', 2], ['c', 1], ['a', 4], ['b', 3], ['c', 2], ['d', 1], and so on. -- Every program eventually reaches a point where it becomes harder to make a simple change than to rewrite the program from scratch. Unfortunately, when this point is reached, it is far too late to consider rewriting it. http://surreal.istic.org/ They knew about the decepticons. pgpNeSV0WxqBg.pgp Description: PGP signature
Re: Classes / roles as sets / subsets
See diagram case 2 (Class A and Class B intersect): B are built from a role that represents their intersection ( Class A U Class B), and then code is added in the definitions of the It may be just me being confused, but the symbol that looks like a U (U+222a) is usually union; intersection is the vertical reflection of that (U+2229). I'm not trying to be picky, but if it's confused me, it's probably confused someone else too. All of which reminds me, I'm looking forward to being able to iterate over my lists with \forall, \elem, and other set notation symbols rather than having to spell stuff out. Perl up to 5 may be executable line noise, but I can see Perl 6 being the closest thing yet to executable maths, and I love it. -- Always crash crash crashWell come on and let me know You're happy when I'm running bash Should I play or should I code? One test is fine, next is black(with apologies to The Clash) So if you want a dodgy hack worse at http://surreal.istic.org/songs pgp8LeNGdwl2b.pgp Description: PGP signature
Re: clarifying the spec for 'ref'
If changing that functionality beyond recognition means changing its external behavior (as opposed to its internal behavior) so that it acts differently from what the superclass had promised to do, then no, it's not any weirder--but I can't figure out how the contract would work, either. That's because you're used to one way of thinking about class inheritance: that the subclass can do everything that the superclass can do, and more. In this scheme, you might have a Square class, with a field representing its corner and another giving its side length. Then, you could build on this to have Rectangle as a subclass, which adds an extra side length, and extra accessors for it. This is a really bad way of making your subclasses work, but your Rectangle has all the fields and methods of your Square, and some extra ones. Another way of looking at it is that the Rectangle is the more generalised one, so it should be the superclass. It has a corner and two side lengths, and associated accessors. Now, your Square is a subclass of this. A Square in this scheme isa Rectangle, with the constraint that the two side lengths are always equal. (Never mind the storage considerations: that's internal.) In the first scheme, even though the subclass only adds capabilities, it breaks the isa relation, because a (real-world) rectangle is not necessarily a square. If you write code that takes a Square, and you give it a Rectangle, all the function calls will still work, but the functionality will be wrong, because it makes assumptions that are no longer true. In the second scheme, the isa relation holds on the real-world things you're abstracting, because a (real-world) square isa rectangle. But the assumption you want to make, that you can call any superclass method on the subclass, no longer really works. (As people said, you can hack around it, but fundamentally it's wrong.) So, if you write code that wants a Rectangle, and you give it a Square, you have to pussy-foot around this externally imposed constraint, but the (smaller set of) assumptions still hold. Most languages use the first scheme of class inheritance, but some offer the second. Perl 6, AFAICS, has the first for subclasses, but offers the second with subtypes and where clauses. I don't believe I've previously used a language that offered both, so I'm interested to see how this conjunction of features will turn out. -- For God's sake, please give it up. Fear it no less than the sensual passion, because it, too, may take up all your time and deprive you of your health, peace of mind and happiness in life. Wolfgang Bolyai, urging his son to give up his research on non-Euclidean geometry pgpgTS8L1fYSd.pgp Description: PGP signature
Re: Heredoc issue in pugs.
: my $a = q:t /END/ : test : END; :print qq:to/END/; :Give $amount to the man behind curtain number $curtain. :END : Which is correct? Both of them are. See the table further down that says: What about the semicolon? After the terminator, or after the opening line? -- Your inertially corrupt space-time disagrees with me. -- Will McCarthy http://surreal.istic.org/ It sounded right in my head. pgpkmeZZf5Xa7.pgp Description: PGP signature
Re: multi-line comments, C macros, Pod abuse
Stuart Cook schreef: Larry Wall: if 0 { ... } The one disadvantage of that approach is that it will break if the commented-out code temporarily fails to compile. How frequent does that happen? All the time. I often comment out bits of code while I'm refactoring or such, because I've removed some functions or that the code depends on s.t. it won't compile any more, I want to compile it to check that the bits I've done work, and I want the commented-out code visible to remind me to rewrite it later. And in that case s/if 0/\#/, as Luke mentioned. And if the compile failure has to do with {}, use other braces. As you say, alternatives are available. But would the following work? 0 or q:to/END42/ ... END42 Shouldn't it be C0 and if you don't want the RHS (or C1 or, I suppose)? In either case, wouldn't this have the side-effect of setting the last-evaluated value, which might also be undesired. -- I will take my life into my hands And I will use it.'MacArthur Park' I will win the worship in their eyes And I will lose it. Jimmy Webb I will have the things that I desire(( http://surreal.istic.org/ And my passion flow like rivers to the sky (( It's like a DEATH CIRCUS! pgpeeNlWlgAhO.pgp Description: PGP signature
Re: Type annotation on expressions
Is it possible to say this one expression? Haskell's syntax is shiny but everybody wants the colon: foo( ( $x :: Moose ) ); I may be in a little world of my own here, but isn't this what 'as' is supposed to do? foo($x as Moose); -- Of all things, good sense is the most fairly distributed: everyone thinks he is so well supplied with it that even those who are the hardest to satisfy in every other respect never desire more of it than they already have. -- Descartes, 1637 http://surreal.istic.org/ signature.asc Description: Digital signature
Re: Patch for S06 (and also S03)
Sorry to patch the patch, but in -Other sigils binds only to the Ilast argument with that name: +Other sigil binds only to the Ilast argument with that name: the replacement makes no more sense than the original. Other sigils bind or Any other sigil binds would work here. Also, I believe the original of have an explicit declarator such as Csub or Cmethod; bare blocks and -pointy subs are never considered to be routines in that sense. To return +pointy blocks are never considered to be routines in that sense. To return from a block, use Cleave instead--see below. is correct. Pointy subs are consistently known as such, and I don't see any reason to rename them: the - symbol promotes a block (and optional arg list) into an anonymous sub, and the name reflects this. -- My invention can be exploited for a certain time as a scientific curiosity, but apart from that it has no commercial value whatsoever. Auguste Lumiere, on his and his brother's new invention of the motion- picture camera %% http://surreal.istic.org/ %% It's like a DEATH CIRCUS! signature.asc Description: Digital signature
Re: Patch for S06 (and also S03)
Oh, thank you very much for correcting this. I didn't even read the sentence after I made the change. ;-) I should be more careful the next time. Bah, you don't need to with an army of attentive proof-readers. I'm sorry that I disagree with this one since I am following Audrey's changes made as r10478: OK. I suppose that's what I get for going on holiday. -- Pray remember that Bacchus was a warrior, and that his armies had little fighting to do, because wherever he appeared he taught the cultivation of the vine to the grateful and submissive natives.-- J.B. Morton http://surreal.istic.org/ Peace through superior firepower. pgp7mbsV5eYUe.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r9728 - doc/trunk/design/syn
+This hides any qX rule that might be defined in the gramma. Note s/gramma/grammar/ if you please. I prefer the new quoting behaviour and I like and as word boundaries. (Sometimes I miss Vim regexes' \ and \.) Are and zero-width? -- The rules of programming are transitory; only Tao is eternal. Therefore you must contemplate Tao before you receive enlightenment. How will I know when I have received enlightenment? asked the novice. Your program will then run correctly, replied the master. pgpJPnPhUcrcr.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r9728 - doc/trunk/design/syn
+This hides any qX rule that might be defined in the gramma. Note s/gramma/grammar/ if you please. Erm, credit TreyHarris on this one, as he seems to have spotted it first on #perl6. -- Of all things, good sense is the most fairly distributed: everyone thinks he is so well supplied with it that even those who are the hardest to satisfy in every other respect never desire more of it than they already have. -- Descartes, 1637 http://surreal.istic.org/ pgphk3MbFh9eh.pgp Description: PGP signature pgpRQfAjcGLsj.pgp Description: PGP signature
Re: Mutil Method Questions
Multimethods are not just overloading as in C++. To expand upon this point a little, you can use multimethods to do pattern-matching in the style of ML and similar languages. So, to pinch an example from the pugs tree (examples/functional/fp.p6) multi sub length () returns Int { 0 } multi sub length (*$x, [EMAIL PROTECTED]) returns Int { 1 + length(@xs) } Now you can call length on a list, and the call will be dispatched to the first multi if the list is empty, the second otherwise. In both cases you're passing a list. Really, this use is caused by having slurpy argument lists as much as by the multis. The quicksort example in examples/algorithms/quicksort.p6 is the clearest and most concise description of quicksort I have yet seen. (The version I usually use when teaching ML is not as nice as this one.) Multis also let you define things that look like methods (in the OO sense) outside the class. This is useful because you might want to have common operations on certain objects be as convenient as method calls, but without needing to give them the privileged access to the object data that methods and submethods get, and without modifying the class itself. -- I went to the CO guess what he told me guess what he told me | apologies He said boy u better learn to like Win no matter what u do | to Prince But he's a fool, 'cos nothing compares, nothing compares 2 GNU ^^ http://surreal.istic.org/songs/?file=Nothing%20Compares%202%20GNU.txt signature.asc Description: Digital signature
bind variable name to type
Would it be useful to have a way of 'binding' a variable name to a given type, in a given lexical scope, such that every time a variable with that name is declared in that scope it gets to be of that type? What I'm thinking of is a bit like how in Fortran variables called n are automatically integers, and x is automatically real, and such, but off by default and such that you can set it for any variable name. My motivation behind this is that I'm currently writing C code where every function declares a variable uErr, always holding an error code, and most functions have variables called things like pUserHandle, always holding a pointer to the same type of data structure. This feature would allow me to write this code (if it were Perl 6) like type $user UserHandle; type $uErr ErrorCode; sub renameUser($user, String $newName) returns ErrorCode { # $user is automatically of type UserHandle my $uErr; # $uErr is automatically of type ErrorCode ... $uErr = ERROR; ... return $uErr; } Yes, this kind of copper-plate code is really annoying, and to an extent OO makes it much easier to write (by not having all your functions take the same argument), but I'm sure we've all written code like this once or twice. You could probably do this with a macro containing a large given/when, but I would prefer an easy-to-read, works-everywhere method. This would give me the convenience of not having to type my types (if you'll excuse the pun) but still allow static type-checking to detect errors and reduce the overhead of variant types. Presumably trying to declare a variable with a bound name to have a different type to the bound one would be a compile-time error. In shops where so-called Hungarian notation is in use (like my current employer), it would make it much more useful, especially if the aliases worked by regex rather than just with one name. That way, you could have a 'coding style' project-wide module with things like type /\$n/ Int; type /\$d/ Real; type /\$sz/ String; and then have everyone use Hungarian; at the top of their files. I'm not suggesting that these things be encouraged, nor that the syntax should be the one I have used, but I can see the feature being really useful in a range of circumstances. Any thoughts? -- The rules of programming are transitory; only Tao is eternal. Therefore you must contemplate Tao before you receive enlightenment. How will I know when I have received enlightenment? asked the novice. Your program will then run correctly, replied the master. signature.asc Description: Digital signature
lvalue functions and lvalue parameters
I've just thought of an interesting interaction with lvalue functions and call by foo. What if I want to write, say, an lvalue ?? !! function thus sub cond(Bool $c, $a, $b) is rw { if $c return $a else return $b; } Will this fail because $a and $b are not rw? If so, will it fail at run- or compile-time? What about this: sub cond(Bool $c, $a is copy, $b is copy) is rw { if $c return $a else return $b; } Is it allowed, and if so is the behaviour to return a writeable copy of $a or $b? I imagine that in any case sub cond(Bool $c, $a is rw, $b is rw) is rw { if $c return $a else return $b; } will do what I want. I suppose the issue comes down to the scope of modifiers like rw. In the first example, $a and $b are constant in the scope of the function, but they aren't written in the scope of the function. They are then passed to the caller which may then try to write them, but will they remember that they are rw in the caller's scope? Furthermore, what if they aren't rw in the caller's scope? my Int $a is constant = 0; my Int $b is constant = 0; (cond(True, $a,$b))++; What goes on here, for any of the cond definitions? Do any of them result in breaking the constancy of $a? I'm not sure, but I think my vote is for contestant number one to fail at compile-time, number two to generate new, writeable copies, and number three to give the returned lvalue the same writeability as its caller. Come to that, what is the behaviour of constant variables being rw'ed in parameter lists? sub rwify($a is rw) { $a += 19; } my Int $a is constant = 23; rwify $a; say The meaning of life is $a; I would imagine it should fail on the function call, but I'm open to other suggestions. -- Humpty Dumpty sat on the wall, Humpty Dumpty had a great fall, All the King's horses and all the King's men | http://surreal.istic.org/ Couldn't put Humpty together again. | powered by cat and ^d Perhaps they shouldn't have given the horses the first go. signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r9575 - doc/trunk/design/syn
-post-assigment forms such as CSIMPLE += SIMPLE is allowed.) +post-assigment forms such as CSIMPLE += SIMPLE are allowed. s/allowed\./allowed)./ Umm, no. The ) was correct in its original position (after the full stop). It just seems to have disappeared. -- Always crash crash crashWell come on and let me know You're happy when I'm running bash Should I play or should I code? One test is fine, next is black(with apologies to The Clash) So if you want a dodgy hack worse at http://surreal.istic.org/songs pgpF8DFcurSQL.pgp Description: PGP signature
Re: $1,000 prize for Perl 6 Wiki written in Perl 6
Ask Bj�rn Hansen [EMAIL PROTECTED] writes: Woah, we are getting really far away from talking about perl6 here... Kind of a usenet law or corollary? Every discussion about wikis ends You're being a bit optimistic there, aren't you? The only way you'd end a my-wiki-is-better-than-yours thread would be to move over to some less controversial issue, like text editors or the Iraq invasion. in a discussion about the best wiki syntax. -- And I see losing love is like a window in your heart: everybody sees you're blown apart; everybody sees the wind blow in Graceland. -- Paul Simon, 1986 ... I am the Dance Commander, and I order FUN! http://surreal.istic.org/ - Installing Windows in your heart since 2003. pgpzDqG9HxT4B.pgp Description: PGP signature
~~ with *
I only vaguely recall the discussions a while back about what smart-matching against Booleans should do. IIRC, there are two positions, and a good argument for either side: C$foo ~~ True means C?$foo; C$foo ~~ False means C! ?$foo or C$foo ~~ True means CTrue; C$foo ~~ False means CFalse The first of these adds expressiveness to given/when, and behaves the intuitive way when both the RHS of a match is a Boolean-valued variable (I would intuitively expect C$bool1 ~~ $bool2 to do Boolean equality). The second means that the default case of a while can be syntactic sugar for Cwhen (true), and I see that we went for the latter on those grounds. However, if we make the Whatever star on the RHS always match, we can make Cdefault equivalent to Cwhen (*), reminiscently of a shell script, and we can also make C$bool1 ~~ $bool2 do the obvious thing. I don't immediately see any big wins for being able to say C$foo ~~ *, nor any big loses for it no longer falling through to MMD. Any thoughts? -- Twelve? Who needs twelve? Couldn't we make do with six? -- Lew Grade, keyid 885b170d trying to cut production costs on 'Jesus of Nazareth' http://surreal.istic.org/ The illegal we do immediately, the unconstitutional takes a little longer. Henry Kissinger, June 1972 signature.asc Description: Digital signature
statement-ending } with if
Can someone explain to me how } on a line on its own can end a statement (as described in the second section of S04), but the following still works? if $condition { ... } else { ... } i.e. Why doesn't the } on the fourth line terminate the if statement, leaving the compiler terminally confused when it sees a bare else? Is this defined as a special case, and if so, could it be mentioned in S04? Alternatively, is the else a magic separate statement all of its own? -- And for mile after mile you'll never see me tire/You'll never me me slow down for a while/'Cause I am the fox, like it or not/I'm always gonna be there running over the rock/ Yes I am the fox, a fascinating cross/ Of sharp as a whip and tough as an ox Bernie Taupin, 'The Fox' signature.asc Description: Digital signature
Re: OT: my wiki syntax is better than yours (was: $1,000 prize for Perl 6 Wiki written in Perl 6)
Also realize that it is not necessarily the duty of Textile (et al) to handle that aspect beyond text formatting. A diff or history-revision view goes beyond the context of the tool. I don't think Juerd was talking about tables for the purposes of showing version diffs, but so you can give pairs of examples of equivalent Perl 5 and Perl 6 code side-by-side. -- I tried snorting coke once, but the bubbles went right up my nose and I knocked the glass over. -- 'Sordid Confessions of a Teenage Innocent' http://surreal.istic.org/It means peace. pgpICvvt4Ocpz.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r9496 - doc/trunk/design/syn
+an function-arguments (CCapture) context on its arguments. You might have fixed the other error while you were at it. s/an/a/ -- My invention can be exploited for a certain time as a scientific curiosity, but apart from that it has no commercial value whatsoever. Auguste Lumiere, on his and his brother's new invention of the motion- picture camera %% http://surreal.istic.org/ %% It's like a DEATH CIRCUS! signature.asc Description: Digital signature
Re: Concurrency: hypothetical variables and atomic blocks
How does an atomic block differ from one in which all variables are implicitly hypotheticalized? I assume that the atomicness being controlled by some kind of lock on entry, it also applies to I/O and other side-effecty things that you can't undo. -- Hats are no worse for being made by ancient hatters, and good butter can be bought in a shop that has no jazz-band. -- J.B. Morton (Beachcomber) P.S. --- Tell Saunders that he must not leave cat's meat on my desk. http://surreal.istic.org/ old-fashioned quality within the McQuary limit pgpo8uNVlMzyj.pgp Description: PGP signature
Re: CGI on 6
(would that be a pliki? a sixwiki? a plixi? erm-) psiki, where the p is silent. Like what you throw when you fancy a free day off work. -- Humpty Dumpty sat on the wall, Humpty Dumpty had a great fall, All the King's horses and all the King's men | http://surreal.istic.org/ Couldn't put Humpty together again. | powered by cat and ^d Perhaps they shouldn't have given the horses the first go. pgpJCW4WLd6sq.pgp Description: PGP signature
Re: Simple Print/Say Question
Wrt your second problem, if this $arg_forarray = [ ( 0 .. $arg_forcount ) »*« $arg_forscale ]; is not rw so is not actually adding the entry to the hash (btw, shouldn't the * be * as the right-hand operand is a scalar?), then it is possible that And then I get an error telling me 'No such method in class Scalar: kv' in the line for %bucketswarray.kv - $i, $w { means that %bucketswarray is being autovivisected (or whatever you call it) as a Scalar element of %bucketsw, rather than being a hash? Just a thought. I was under the impression that writing to an argument that is not rw should generate an error, unless it is copy, in which case it should do what it seems to be doing. It's possible that Pugs has not (yet) implemented this exactly, though. -- You can't run away forever, but there's nothing wrong with getting a good head start. You want to shut out the night, you want to shut down the sun, you want to shut away the pieces of a broken heart. `Rock and Roll Dreams Come True' (Steinman)http://surreal.istic.org/ signature.asc Description: Digital signature
Re: 3 Good Reasons...
what problems Perl 5 has that Perl 6 fixes A type system to die for. I think that is enough of a win on its own that mentioning any of the other features will only muddy the issue :- -- The fact that some geniuses were laughed at does not imply that all who are laughed at are geniuses. They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown. -- Carl Sagan http://surreal.istic.org/ pgp0NuJ6AmfNS.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r9216 - doc/trunk/design/syn
(string) context. You can force list context on the expression using -either the C* or Clist operator if necessary. +either the Clist operator if necessary. English not being executable line noise, you can't use either to force a scalar into list context. -- Twelve? Who needs twelve? Couldn't we make do with six? -- Lew Grade, keyid 885b170d trying to cut production costs on 'Jesus of Nazareth' http://surreal.istic.org/ The illegal we do immediately, the unconstitutional takes a little longer. Henry Kissinger, June 1972 pgpRlULZ4Qcg1.pgp Description: PGP signature
Re: A rule by any other name...
Including :skip(/someotherrule/). Yes, agreed, it's a huge improvement. I'd be more comfortable if the default rule to use for skipping was named skip instead of ws. (On IRC sep was also proposed, but the connection between :skip and skip is more immediately obvious.) Yes, I like skip too. I too keep mistakely reading ws as WhiteSpace. For another datapoint, I like the idea of wb as word-boundary. After all, when you're tokenizing input, you're interested in the boundaries that separate tokens rather than the whitespace or what you do with it. Although I like the connection between skip and :skip, skip to me isn't very suggestive, and ws sounds too much like whitespace. wb, to me at least, is reminiscent of \b, and of Vim's \ \ for word boundaries. I'm sure I'll get used to whatever the final name is, though; just wanted to spread ideas. There are, to my mind, two ways of looking at whitespace: 1) Whitespace in regexes is ignored other than to delineate tokens in the regex. :skip() defines which characters in the input string are skipped over by the matcher (regex engine, whatever you want to call it). 2) Whitespace in regexes is significant. :skip() defines the meaning of a block of whitespace in the regular expression. AFAICS, both these states of mind come out to the same thing in the end (someone correct me if I'm wrong), but the naming scheme makes much more sense if you are thinking about it the first way. -- For God's sake, please give it up. Fear it no less than the sensual passion, because it, too, may take up all your time and deprive you of your health, peace of mind and happiness in life. Wolfgang Bolyai, urging his son to give up his research on non-Euclidean geometry signature.asc Description: Digital signature
Re: S02: generalized quotes and adverbs
qX ::= q:x:y:z; as a simple, argumentless word macro. But would that DWIM when I come to write qX(stuff, specifically not an adverb argument); ? -- The rules of programming are transitory; only Tao is eternal. Therefore you must contemplate Tao before you receive enlightenment. How will I know when I have received enlightenment? asked the novice. Your program will then run correctly, replied the master. pgpXeXXcH6srs.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r8907 - doc/trunk/design/syn
return a boolean for either 1 or 0 arguments. Negated operators, -return Bool::False, and all the rest return Bool::True. +return CBool::False, and all the rest return CBool::True. The comma on the first line is superfluous. -- I will take my life into my hands And I will use it.'MacArthur Park' I will win the worship in their eyes And I will lose it. Jimmy Webb I will have the things that I desire(( http://surreal.istic.org/ And my passion flow like rivers to the sky (( It's like a DEATH CIRCUS! pgpupUYk9bGcG.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r8883 - doc/trunk/design/syn
+but rather easier to read. The bare C*, C+ and C? quantifiers +never backtrack in a Ctoken unless some outer rule has specified a +C:panic option that applies. If you want to prevent even that, use +C*:, C+: or C?: to prevent any backtracking into the quantifier. +If you want to explicitly backtrack, append either a C? or a C+ +to the quantifier. The C? forces minimal matching as usual, +while the C+ forces greedy matching. The Ctoken declarator is +really just short for + +rule :ratchet { ... } + +The other is the Cparse declarator, for declaring non-terminal +productions in a grammar. It also does not backtrack unless a +C:panic is in effect or you explicitly specify a backtracking +quantifier. In addition, a Cparse rule also assumes C:words. I really don't like the second-to-last sentence above (It also does not...). It took me a few reads-through to parse it, and it sounds like it means, Like ctoken, it does not backtrack unless a C:panic is in effect. In addition, it does not backtrack if you explicitly specify a backtracking quantifier. Perhaps you could reword the end of that paragraph as: Like Ctoken, it only backtracks when a C:panic is in effect or when you explicitly specify a backtracking quantifier. Unlike Ctoken, it also assumes C:words, making it equivalent to rule :ratchet :words { ... } -- You can't run away forever, but there's nothing wrong with getting a good head start. You want to shut out the night, you want to shut down the sun, you want to shut away the pieces of a broken heart. `Rock and Roll Dreams Come True' (Steinman)http://surreal.istic.org/ signature.asc Description: Digital signature
Re: foo..bar or long dot and the range operator
I *still* don't understand the problem this long dot is trying to solve. I'm a bit with you, there. I can see why you might want to do $query .fetchrow($i) .selectcolumn($j) .say; rather than $query. fetchrow($i). selectcolumn($j). say; but surely $query. .fetchrow($i). .selectcolumn($j). .say; is the worst of both worlds? And it strikes me that the ability to put big, block comments between operator and operand is not a particularly useful one. -- Of all things, good sense is the most fairly distributed: everyone thinks he is so well supplied with it that even those who are the hardest to satisfy in every other respect never desire more of it than they already have. -- Descartes, 1637 http://surreal.istic.org/ pgpOtLBH4P7Po.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r8625 - doc/trunk/design/syn
+insert a line break into a sequence of methods calls include: s/methods/method/ A consequence of the postfix rule is that (except when delimiting a ... +a quote or terminating a long dot) a dot with whitespace in front Too many a's. +you to insert optional whitespace and commentsbetween dots: How about inserting whitespace between keywords? On a lighter note: +MyType. .::. .{'$foo'} Perl 6, the language of executable ASCII art. The old camel-duplication script has got nothing on this. Signed, Your friendly neighbourhood proof-reader. -- And I see losing love is like a window in your heart: everybody sees you're blown apart; everybody sees the wind blow in Graceland. -- Paul Simon, 1986 ... I am the Dance Commander, and I order FUN! http://surreal.istic.org/ - Installing Windows in your heart since 2003. pgp769CYAKtux.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r8562 - doc/trunk/design/syn
+If this MMD dispatch succeeds, the result becomes the result of the +of the reduce. MMD dispatch ~~ RAS syndrome Also note the two of thes. +Otherwise, if the MMD dispatch fails, then if there is one argument, +while the single argument form can MMD dispatch based on the type of Ditto RAS. Dan, Uri's grammar Lord Haw Haw -- It must be accepted as a principle that the rifle, effective as it is, cannot replace the effect produced by the speed of the horse, the magnetism of the charge, and the terror of cold steel. -- British Cavalry training manual, 1907 ::: http://surreal.istic.org/ pgpTU2qdLNWc2.pgp Description: PGP signature
Re: [svn:perl6-synopsis] r8511 - doc/trunk/design/syn
Values with these types autoboxes to their uppercase counterparts when Sorry to be picky after your quick response, but s/autoboxes/autobox/; -- Mary had a little sprout,From week to week, from month to month, Its fleece was green as grass, She kept the sprout in tow, She hitched it to a bit of string,And everywhere that Mary went, The silly little ass. The sprout was sure to go. signature.asc Description: Digital signature
Re: [svn:perl6-synopsis] r7812 - doc/trunk/design/syn
+use Sense common :EXPORT@horse; # import common but exports # @horse As typos seem to be in favour today, might I suggest s/exports/export/ so all the verbs agree in number? Apologies for the short context but I had enough of a fight with the wrapping logic on this one. -- I must study politics and war that my sons may have liberty to study mathematics and philosophy. My sons ought to study mathematics and philosophy... in order to give their children a right to study painting, poetry, music, architecture, statuary, tapestry, and porcelain. J. Adams pgpVYfnjjoBsr.pgp Description: PGP signature
Re: Problem with dwimmery
As a third possibility, could we huffman-code do nothing clauses by leaving out the appropriate argument? That is: while $x-- some_condition($x); That's a bit too short for my liking: it is likely to lead to the traditional C undetectable bug when you write while $x-- some_condition($x); { some_operation($x); } modulo brace style, of course. -- Stop the infinite loop, I want to get off! http://surreal.istic.org/ Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon The documentation that can be written is not the true documentation.
Re: type sigils redux, and new unary ^ operator
If .indexes turns out to be used a lot, then let's have .i -- i for index is accepted abbreviation, isn't it? (Think for (i = 0; ...; ...)) +1 here. I too find ^$n a bit bizarre, but I like the look of for @foo.i OTOH, I like the parallels between %foo.keys and @foo.keys -- it recalls the idea that an array can be thought of as a hash where the keys are constrained to be sequential (or not, if it is sparse) integers. -- Stop the infinite loop, I want to get off! http://surreal.istic.org/ Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon The documentation that can be written is not the true documentation.
Re: Hyphens vs. Underscores
No sane person would put their braces in different places in different parts of their code, so why don't we just say, from now on, you must use brace style X? Have you never seen code that's been worked on by several people with differing tastes in brace positioning and no coding standard? Have you never copied a chunk of code from one place to another 'temporarily' without adjusting the indentation (though, admittedly, most editors will do it for you)? People *do* mix brace and indentation styles in the same file, and it is ugly when it happens, but it doesn't change the meaning of the program. -- Stop the infinite loop, I want to get off! http://surreal.istic.org/ Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon The documentation that can be written is not the true documentation.
Re: Perl 6 fears
The current list of fears is: You don't include my personal fear. FEAR: I will need a lobotomy before I can make sense of Perl 6! -- Stop the infinite loop, I want to get off! http://surreal.istic.org/ Paraphernalia/Never hides your broken bones,/ And I don't know why you'd want to try:/ It's plain to see you're on your own.-- Paul Simon The documentation that can be written is not the true documentation.