Re: Same-named arguments
Mostly, it's that func('x' = 1) requires a bit too much typing, and also makes it hard for func() to change its signature later on to accept things other than Code. I was discussing this with a friend of mine (Eric Livak), and he suggested making the sigil on the name optional for disambiguation. I was wondering if there's a possibly a way to automatically determine which parameter to pass to based on the type of the argument. Since I'm really not that well-versed on the language, and definitely know nothing about the internals, I don't know if that's asking the impossible, but it seems to me like a simple solution. Michael
Re: Same-named arguments
On 8/26/06, Audrey Tang [EMAIL PROTECTED] wrote: Mostly, it's that func('x' = 1) requires a bit too much typing, and also makes it hard for func() to change its signature later on to accept things other than Code. Allow me to make an immodest proposal. Have named parameter passing look like this: ':' . param name (including sigil) . ( '(' . value . ' )' x (0|1)). So func('x' = 1) would become func(:x(1)). The colon would consistently have the effect of preventing evaluation of the key (as it currently does by having :foo(1) not call foo()). The call foo(:$bar($baz)) would assign the value of the variable $baz to the named parameter '$bar and would have nothing to do with the caller's $bar variable, although it could default to that so that foo(:$bar) would still have its current semantics. Perhaps the sigil could be optional when there is only one parameter matching the rest of the name, or else the callee's signature would be able to specify that the sigil is optional. I would then make key = value always be a Pair value. For module writers to support perl5 calling semantics, I'd prefer a mechanism for asking for that explicitly in the signature rather than jumping through hoops to support it by default. Perhaps there could be a rule that, in the absence of a slurpy hash declaration, any trailing Pairs are scanned for matches to named parameters? -- Mark J. Reed [EMAIL PROTECTED]
Weekly Perl 6 mailing list summary for August 20-26, 2006
This week on the Perl 6 mailing lists My school's punch card machines were in the same room as the TRS-80 Model I (THE COMPUTER ROOM). These kids today with their hula hoops and fax machines and intarwebs... -- Chip Salzenberg, arguing in *favor* of lines in excess of 80-characters. perl6-language multi-line comments, C macros, Pod abuse http://xrl.us/qyci Last week's summary covered this thread, which discussed easily commenting out a large chunk of code. This week the discussion continued slightly in to the realm of meta-programming and programming environments, but not much meat was added. clarify: does Dog is Mammal load Mammal for you? http://xrl.us/q5ge Mark Stosberg asked for clarification on S12 on whether `class Dog is Mammal` requires Mammal to be loaded in advance. The current version of Pugs needs an explicit `use Mammal`. Darren Duncan believed an implicit `use Mammal` should only occur conditionally, if a Mammal had been declared, but was concerned about potential bugs. Jonathan Scott Duff had the impression that preloading would not be required, and wondered if `class Dog is Mammal-4.5` would be valid. Trey Harris referenced S11 to claim that Jonathan's questionable syntax is valid. Andrew Suffield also tackled the question of versioned libraries. Heredoc issue in pugs. http://xrl.us/q5gg Yiyi Hu wanted to know the correct syntax for heredocs, as S02 and Pugs seem to be at odds. Larry Wall clarified that both are allowed. Luke Palmer expressed concern about the false duality of `:to` and `:from`. Larry noted that is why `:from` doesn't actually exist. Pair of lists = list of pairs? http://xrl.us/rav7 Mark J. Reed asked how one would idiomatically write `my %h; @[EMAIL PROTECTED] = @[EMAIL PROTECTED] in Perl 6. Gaal Yahas suggested using ??, the `zip` operator: `my %h = @keys ?? @values`. Larry Wall suggested using a hyper pair: `my %h = @keys ??=?? @values`. clarifying the spec for 'ref' http://xrl.us/rav8 Mark Stosberg wanted Perl 6 to retain the Perl 5 responses to `ref` or justify the change in the documentation. Larry Wall explained that `ref` will not exist in Perl 6; instead, it will be something like `.what`, which will return the type itself, rather than a string. The thread then moved on to subclassing, after Luke Palmer suggested that `Array` would be a subtype of `Array::Const`, after Larry had stated the reverse. This led to a lengthy discussion on the subject. My first functional perl6 program http://xrl.us/rav9 Mark J. Reed posted a simple program he wrote in Perl 6 for educational purposes, asking for critique. This lead to a discussion on the semantics of hyperoperators in relation to finite/infinite sequences. perl6-internals [perl #40162] [PATCH] parrot/trunk/docs/art/pp001-intro.pod - spelling http://xrl.us/qvmp Last week, in ticket [perl #40162] http://xrl.us/qvmq, Amir E . Aharoni sent a patch to correct some spelling errors. It was applied as r14297. [REPATCH] Parrot::Embed Take Two http://xrl.us/qyb8 Previously, chromatic submitted a patch for the build file to try to resolve pkg_config issues with various platforms. He had some questions about installing from outside the Parrot tree on Windows. Leopold Toetsch offered a suggestion. This week, Fran??ois Perrard explained how to solve the Windows issue. [perl #40204] line numbers of runtime errors are one too low http://xrl.us/q5gh Chip Salzenberg created ticket [perl #40204] http://xrl.us/rawa because runtime errors are off by one line. Leopold Toetsch thought this was the same error reported in [perl #38594] http://xrl.us/rawb, but Will Coleda disagreed. There was some discussion on when new tickets should be created. SKIPs Are Now a Code Smell http://xrl.us/q5gj chromatic made two commits to unskip some valid tests. He was concerned about the large number of tests which are being skipped in Parrot. He suggested unskipping all tests which might pass, and use TODO or deletion depending upon the relevance of the test. This was added as a Cage Cleaner's task. [perl #40207] [PATCH] tools/dev/install_files.pl - replace tabs with spaces http://xrl.us/raw6 Amir E . Aharoni created the ticket, [perl #40207] http://xrl.us/rawc, in which he supplied a patch that corrects the indentation of `tools/dev/install_files.pl`. [perl #40209] [TODO] convert t/compilers/pge/p6regex/01-regex.t to PIR http://xrl.us/q5gq Will Coleda wanted the tests in PIR instead of Perl to make `make test` faster and to give a template for other test conversions. See ticket [perl #40209] http://xrl.us/rawd. [perl #40210] [TODO] Provide a way for PGE's dump to go to string http://xrl.us/q5gr In ticket [perl #40210]
multi subs with identical signatures: should be a warning ?
First, what's the recommended reference for learning how dispatching to the right 'multi' sub is resolved. ? I'd like to know the expected behavior in this case: multi sub foo () { say b: } multi sub foo () { say a: } foo(); I would expect it would throw an error or at least a warning, since there's no clear way to choose a correct sub to dispatch to. Pugs currently dispatches to one anyway, without a warning. A more insidious version of the same case is the following, which I accidentally wrote more than once already...and then wondered why my code wasn't working as expected... multi sub foo (%names?) { say b: } multi sub foo (@pos?) { say a: } There, I have distinct arguments, but they are both optional, making them the same as the case above. Mark.
LLVM and C99 and classic Mac OS (Re: LLVM and HLVM)
On Aug 22, 2006, at 5:52 PM, John Siracusa wrote: Has anyone looked at LLVM lately? http://llvm.org/ I discovered it a few years ago. My personal interest is in the portable C back end, so I can use the g++ compiler front end and send the output through CodeWarrior or MPW compilers, whose language support is frozen due to non-development (and therefore may have issues with C99 or modern C++ constructs) but handle C89 just fine. This will require a fairly large Round Tuit, of course. This pattern may also be applicable to MSVC. Josh P.S. Hi, John! I loved your article on the Spatial Finder.
[svn:perl6-synopsis] r11504 - doc/trunk/design/syn
Author: larry Date: Sun Aug 27 22:52:36 2006 New Revision: 11504 Modified: doc/trunk/design/syn/S02.pod Log: Clarification on syntactic mapping of a b and c to ('a','b') and ('c'). Modified: doc/trunk/design/syn/S02.pod == --- doc/trunk/design/syn/S02.pod(original) +++ doc/trunk/design/syn/S02.podSun Aug 27 22:52:36 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall [EMAIL PROTECTED] Date: 10 Aug 2004 - Last Modified: 15 Aug 2006 + Last Modified: 27 Aug 2006 Number: 2 - Version: 65 + Version: 66 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1394,6 +1394,43 @@ The Cqw/foo bar/ quote operator now has a bracketed form: C foo bar . When used as a subscript it performs a slice equivalent to C{'foo','bar'}. +Elsewhere it is equivalent to a parenthesisized list of strings: +C ('foo','bar') . Since parentheses are generally reserved just for +precedence grouping, they merely autointepolate in list context. Therefore + +@a = 1, 2 3 , 4; + +is equivalent to + +@a = 1, 2, 3, 4; + +In scalar context, though, the implied parentheses are not removed, so + +$a = a b ; + +is equivalent to: + +$a = ('a','b'); + +which, because the list is in scalar context, is autopromoted an Array object: + +$a = ['a','b']; + +Likewise, if bound to a scalar parameter, C a b will be +treated as a single list object, but if bound to a slurpy parameter, +it will auto-flatten. + +But note that under the parenthesis-rewrite rule, a single value will +still act like a scalar value. These are all the same: + +$a = a ; +$a = ('a'); +$a = 'a'; + +And if bound to a scalar parameter, no list is constructed. +To force a single value to become a list object in scalar context, +you should use C ['a'] for clarity as well as correctness. + Much like the relationship between single quotes and double quotes, single angles do not interpolate while double angles do. The double angles may be written either with French quotes, C«$foo @bar[]», or