Punie ported to PAST-pm
I've just checked in the modified Punie code that runs on the improved compiler tools. I sent various comments to the list as I went through the port, so I won't repeat them here. A few more comments from the end of the porting process: - I like the way PAST-pm handles conditionals. It makes for simple transformations at the PAST stage (especially if conditionals are parsed recursively). - I like the way PAST-pm handles comma operators. - The modifications to HLLCompiler mean the core compiler script for Punie is quite short. Very nice. - I ran into one bit of strangeness with the assignment operator on simple strings (it was generating an 'assign' opcode with 3 arguments for the source code "$x = 'test'"). I solved it by setting 'pasttype' to 'assign', but now the generated code is unnecessarily calling the 'clone' opcode (e.g. "clone $P10, $P10"). I'll come back and look at it later. - The old Punie was loading a library of builtin functions in the 'main' routine of every generated Perl 1 script. I haven't figured out how to do that yet in the new PAST, which means that I can only run Perl 1 scripts interpreted. They fail when pre-compiled to .pir files because the builtins aren't loaded. I didn't delete the POST implementation from languages/punie/lib, because IIRC, it was being used by other language implementations. I'll come back and delete it after I hear that anyone who was using it has moved to the new POST. Many thanks to Patrick for all the work he's put into PAST-pm and HLLCompiler. They're a huge step of progress. Allison
Re: gather { if $xy.was_taken { ... } }
Gilbert R. Röhrbein ha scritto: Hi, I'm new to Perl 6 (and perl). Is there a way to check inside a gather-block if something was allready taken? I thought it would look like one of the following, but it doesnt work on my pugs 6.2.13. gather { for 1..100 { take $_ unless @_.contains(42) } } I think in place of @_ you'd want "gathered" which gives you access to the anonymous array being constructed from gather/take. But AFAIK this does not work in pugs 6.2.13 :/
99 problems in Perl6: problem 28
Hi everyone, and happy new year! I'm an almost complete newbie to Perl6 and I'm not that good at Perl5 either, but I thought playing with these problems could be fun, so I tried to solve #28. My solution is attached, it seems to work, but I'd like to know from people more expert than me if there could be a better solution. The first part seems reasonable, the second could probably be a one-liner. Probably I could replace usage of hash+for with gather/take and nested lists, but I don't think this makes the solution cleaner. Thanks in advance for any suggestion. use v6-alpha; use Test; plan 2; # P28 (**) Sorting a list of lists according to length of sublists # # a) We suppose that a list contains elements that are lists themselves. The # objective is to sort the elements of this list according to their length. E.g. # short lists first, longer lists later, or vice versa. # # Example: # * (lsort '((a b c) (d e) (f g h) (d e) (i j k l) (m n) (o))) # ((O) (D E) (D E) (M N) (A B C) (F G H) (I J K L)) # # b) Again, we suppose that a list contains elements that are lists themselves. # But this time the objective is to sort the elements of this list according to # their length frequency; i.e., in the default, where sorting is done # ascendingly, lists with rare lengths are placed first, others with a more # frequent length come later. # # Example: # * (lfsort '((a b c) (d e) (f g h) (d e) (i j k l) (m n) (o))) # ((i j k l) (o) (a b c) (f g h) (d e) (d e) (m n)) # # Note that in the above example, the first two lists in the result have length 4 # and 1, both lengths appear just once. The third and forth list have length 3 # which appears twice (there are two list of this length). And finally, the last # three lists have length 2. This is the most frequent length. # # Arithmetic my @input= [],[],[],[],[],[],[]; my @expected= [],[],[],[],[],[],[]; # we could use # sort: {+$_} # but pugs seem to not support this yet my @[EMAIL PROTECTED]: {+$^a <=> +$^b}; is @expected, @sorted, "We should be able to sort a list of lists according to length of sublists"; # the list is not the same as in the sample text, when two lists have the # same frequency of length the ordering is unspecified, so this should be ok @expected= [],[],[],[],[],[],[]; # group lists by length my %grouped; for (@input) {%grouped{+$_}.push($_)} # now sort the values by frequency, again can't use # sort: {+$_} @sorted= %grouped.values.sort: {+$^a <=> +$^b}; is @expected,@sorted, "..or according to frequency of length of sublists"
[perl #41159] Re: [PATCH] fix wrong $include_path (of parrot) in Makefile.PL
# New Ticket Created by "Lee Duhem" # Please include the string: [perl #41159] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41159 > 2007/1/1, Debian User <[EMAIL PROTECTED]>: > This patch fix the wrong parrot include path, for example: > > before patch: > /home/lee/parrot/workinginclude > > after patch: > /home/lee/parrot/working/include > You can get the patch from http://groups.google.com/group/perl.perl6.compiler/browse_thread/thread/29c5077ee04eef5f/baf92086c1d9497e#baf92086c1d9497e After fix this, I got more compile error, for example: Building Pugs-6.2.13... [ 8 of 96] Compiling Pugs.Exp[boot] ( src/Pugs/Exp.hs-boot, nothing ) [10 of 96] Compiling Pugs.Version ( src/Pugs/Version.hs, dist/build/Pugs/Version.o ) In file included from /home/lee/parrot/working/include/parrot/string.h:17, from /usr/local/lib/ghc-6.6/include/HsBase.h:59, from /tmp/ghc5065_0/ghc5065_0.hc:4:0: /home/lee/parrot/working/include/parrot/pobj.h:24:0: error: syntax error before "DPOINTER" /home/lee/parrot/working/include/parrot/pobj.h:24:0: warning: no semicolon at end of struct or union /home/lee/parrot/working/include/parrot/pobj.h:24:0: warning: no semicolon at end of struct or union ... GHC use the wrong head file string.h, it should include /usr/include/string.h, but at now it use parrot's string.h. I have try to resolve this problem myself last night, but not success.
[perl #41157] [PATCH] Fix a typo in t/op/cmp-nonbranch.t
# New Ticket Created by "Lee Duhem" # Please include the string: [perl #41157] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41157 > The attached patch fix a typo in t/op/cmp-nonbranch.t and append some editor instruction coda, copy from t/op/comp.t, on it. $ diffstat /tmp/cmp-nonbranch.patch cmp-nonbranch.t |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Lee Index: t/op/cmp-nonbranch.t === --- t/op/cmp-nonbranch.t(revision 16354) +++ t/op/cmp-nonbranch.t(working copy) @@ -1198,7 +1198,7 @@ .local string exp, res .local string desc -.SET_DESC('isnull') +.SET_DESC('cmp') init: set I0, 10 @@ -1257,3 +1257,9 @@ is(exp, res, desc) .end +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4:
[perl #41158] [BUG] Here Docs in test C cause t/op/cmp-nonbranch.t abnormal exit
# New Ticket Created by "Lee Duhem" # Please include the string: [perl #41158] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41158 > The here docs in test C cause t/op/cmp-nonbranch.t abnormal exit, for example: $ /usr/local/bin/perl t/harness --gc-debug --running-make-test -b t/op/cmp-nonbranch.t t/op/cmp-nonbranch in file 't/op/cmp-nonbranch.t' line 1264 t/op/cmp-nonbranchdubious Test returned status 1 (wstat 256, 0x100) FAILED--1 test script could be run, alas--no output ever seen after delete/comment here docs in test C, we get this deliberate failure: $ /usr/local/bin/perl t/harness --gc-debug --running-make-test -b t/op/cmp-nonbranch.t t/op/cmp-nonbranchFAILED test 88 Failed 1/88 tests, 98.86% okay Failed Test Stat Wstat Total Fail List of Failed --- t/op/cmp-nonbranch.t 881 88 Failed 1/1 test scripts. 1/88 subtests failed. Files=1, Tests=88, 1 wallclock secs ( 0.19 cusr + 0.03 csys = 0.22 CPU) Failed 1/1 test programs. 1/88 subtests failed. Lee
Re: 99 problems in Perl6: problem 28
Ah, nice to see someone else tackling the problems. Assuming the tests pass (I can't check this at work) and you have a commit bit, check it in! Cheers, Ovid --- gabriele renzi <[EMAIL PROTECTED]> wrote: > Hi everyone, and happy new year! > > I'm an almost complete newbie to Perl6 and I'm not that good at Perl5 > > either, but I thought playing with these problems could be fun, so I > tried to solve #28. > > My solution is attached, it seems to work, but I'd like to know from > people more expert than me if there could be a better solution. > > The first part seems reasonable, the second could probably be a > one-liner. > Probably I could replace usage of hash+for with gather/take and > nested > lists, but I don't think this makes the solution cleaner. > > Thanks in advance for any suggestion. > > use v6-alpha; > use Test; > plan 2; > > # P28 (**) Sorting a list of lists according to length of sublists > # > # a) We suppose that a list contains elements that are lists > themselves. The > # objective is to sort the elements of this list according to their > length. E.g. > # short lists first, longer lists later, or vice versa. > # > # Example: > # * (lsort '((a b c) (d e) (f g h) (d e) (i j k l) (m n) (o))) > # ((O) (D E) (D E) (M N) (A B C) (F G H) (I J K L)) > # > # b) Again, we suppose that a list contains elements that are lists > themselves. > # But this time the objective is to sort the elements of this list > according to > # their length frequency; i.e., in the default, where sorting is done > # ascendingly, lists with rare lengths are placed first, others with > a more > # frequent length come later. > # > # Example: > # * (lfsort '((a b c) (d e) (f g h) (d e) (i j k l) (m n) (o))) > # ((i j k l) (o) (a b c) (f g h) (d e) (d e) (m n)) > # > # Note that in the above example, the first two lists in the result > have length 4 > # and 1, both lengths appear just once. The third and forth list have > length 3 > # which appears twice (there are two list of this length). And > finally, the last > # three lists have length 2. This is the most frequent length. > # > # Arithmetic > > > my @input= [],[],[],[],[],[ n>],[]; > my @expected= [],[],[],[],[],[],[ k l>]; > > # we could use > # sort: {+$_} > # but pugs seem to not support this yet > > my @[EMAIL PROTECTED]: {+$^a <=> +$^b}; > is @expected, >@sorted, >"We should be able to sort a list of lists according to length of > sublists"; > > # the list is not the same as in the sample text, when two lists have > the > # same frequency of length the ordering is unspecified, so this > should be ok > > @expected= [],[],[],[],[],[],[ n>]; > > # group lists by length > > my %grouped; > for (@input) {%grouped{+$_}.push($_)} > > # now sort the values by frequency, again can't use > # sort: {+$_} > > @sorted= %grouped.values.sort: {+$^a <=> +$^b}; > is @expected,@sorted, "..or according to frequency of length of > sublists" > -- Buy the book -- http://www.oreilly.com/catalog/perlhks/ Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/
Re: 99 problems in Perl6: problem 28
Ovid ha scritto: Ah, nice to see someone else tackling the problems. yes, it was such a nice idea :) Assuming the tests pass (I can't check this at work) and you have a commit bit, check it in! they pass here, but I have no commit bit, it's ok if I do a darcs push? (I prefer it over svn) By the way, any comments on the code? :)
Re: 99 problems in Perl6: problem 28
--- gabriele renzi <[EMAIL PROTECTED]> wrote: > > Assuming the tests > > pass (I can't check this at work) and you have a commit bit, check > it > > in! > > they pass here, but I have no commit bit, it's ok if I do a darcs > push? > (I prefer it over svn) That's not my place to say. I can't give commit bits (and to be fair, it was possibly a bit cheeky of me to push this into Pugs, but no one objected on #perl6). > By the way, any comments on the code? :) I thought it looked quite nice, but given that I can't run it at work, I can't say more than that :) Cheers, Ovid -- Buy the book -- http://www.oreilly.com/catalog/perlhks/ Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/
Re: 99 problems in Perl6: problem 28
On Tue, Jan 02, 2007 at 12:25:29PM +0100, gabriele renzi wrote: > >Assuming the tests pass (I can't check this at work) and you have > > a commit bit, check it in! > > they pass here, but I have no commit bit, it's ok if I do a darcs push? > (I prefer it over svn) You have one now :) (The darcs mirror used to be one-way; I don't know if this has changed.) > By the way, any comments on the code? :) Come over to #perl6 on freenode. -- Gaal Yahas <[EMAIL PROTECTED]> http://gaal.livejournal.com/
Re: [perl #41158] [BUG] Here Docs in test C cause t/op/cmp-nonbranch.t abnormal exit
On 12/31/06, via RT Lee Duhem <[EMAIL PROTECTED]> wrote: # New Ticket Created by "Lee Duhem" # Please include the string: [perl #41158] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41158 > The here docs in test C cause t/op/cmp-nonbranch.t abnormal exit, for example: $ /usr/local/bin/perl t/harness --gc-debug --running-make-test -b t/op/cmp-nonbranch.t t/op/cmp-nonbranch in file 't/op/cmp-nonbranch.t' line 1264 t/op/cmp-nonbranchdubious Test returned status 1 (wstat 256, 0x100) FAILED--1 test script could be run, alas--no output ever seen after delete/comment here docs in test C, we get this deliberate failure: $ /usr/local/bin/perl t/harness --gc-debug --running-make-test -b t/op/cmp-nonbranch.t t/op/cmp-nonbranchFAILED test 88 Failed 1/88 tests, 98.86% okay Failed Test Stat Wstat Total Fail List of Failed --- t/op/cmp-nonbranch.t 881 88 Failed 1/1 test scripts. 1/88 subtests failed. Files=1, Tests=88, 1 wallclock secs ( 0.19 cusr + 0.03 csys = 0.22 CPU) Failed 1/1 test programs. 1/88 subtests failed. Lee these tests pass on windows, so i didn't catch it when i added this file. it seems there's something funny with parrot heredocs and CRLF. i don't know if this is expected behavior or not (it's untested.) i'll have to look further. in any case, these tests should pass now, in r16381. i fixed this by setting the eol-style property on the test file to 'native'. thanks for reporting. ~jerry
Re: Punie ported to PAST-pm
On Tue, Jan 02, 2007 at 12:01:54AM -0800, Allison Randal wrote: > - I ran into one bit of strangeness with the assignment operator on > simple strings (it was generating an 'assign' opcode with 3 arguments > for the source code "$x = 'test'"). I solved it by setting 'pasttype' to > 'assign', but now the generated code is unnecessarily calling the > 'clone' opcode (e.g. "clone $P10, $P10"). I'll come back and look at it > later. PAST-pm's handling of assignment is about to be refactored a bit in order to support Perl 6's binding operator (:=). Yes, the generated code sometimes calls a clone when it doesn't need to -- this is going be handled by having PAST-pm keep track of which PMCs are "temporaries" and thus available for re-use instead of requiring cloning. > - The old Punie was loading a library of builtin functions in the 'main' > routine of every generated Perl 1 script. I haven't figured out how to > do that yet in the new PAST, which means that I can only run Perl 1 > scripts interpreted. They fail when pre-compiled to .pir files because > the builtins aren't loaded. I'll look into this one a bit. One of the next items that will be implemented in perl6 (and may make it into PAST-pm) will be to support BEGIN/CHECK/INIT/END blocks. Thanks! Pm
Re: Numeric Semantics
On Sun, Dec 31, 2006 at 03:02:08AM -0800, Darren Duncan wrote: : At 9:34 AM + 12/29/06, Luke Palmer wrote: : >When do we do integer/rational math and when do we do floating point math? : > : >That is, is 1 different from 1.0? Should 10**500 be infinity or a 1 : >with 500 zeroes after it? Should 10**10**6 run out of memory? Should : >"say (1/3)**500" print a bunch of digits to the screen or print 0? : > : >These are just examples. Exponentials are the easiest to think about : >limit cases with, but the whole general issue needs precise semantics. : : Related to that question, I'd like to draw the list's attention to a : #perl6 discussion that several of us had today: : : http://colabti.de/irclogger/irclogger_log/perl6?date=2006-12-31 : : Following from this, I propose that we have distinct-looking : operators (not just multis) that users can explicitly choose when : they want to do integer division/modulus or non-integer : division/modulus. : : For example, we could have: : : div - integer division : mod - integer modulus : / - number division : % - number modulus : : Or alternately: : : idiv - integer division : imod - integer modulus : ndiv - number division : nmod - number modulus : : And in that case, "/" and "%" would be aliases for an alphanumeric : pair that can be changed using a lexical pragma; they would default : to ndiv/nmod. : : In that case, the explicit "/" and "%" use would be subject to change : behaviour depending on the influence of a pragma, while explicit : idiv/imod/ndiv/nmod use would stay the same no matter what pragma is : in effect. Something's been bugging me about this for days, and I think I finally have a feeling about what it is. It's a reinventing-the-wheel kind of feeling: most of these operators already *have* names, if you count long names that include the return type. infix::($x, $y --> Int) infix::(Int $x, Int $y --> Int) infix::($x, $y --> Num) infix::(Num $x, Num $y --> Num) infix::($x, $y --> Rat) infix::(Rat $x, Rat $y --> Rat) assuming suitable implementation of general forms. But see below. : Note that the i/n variants would cast all their arguments as Int/Num : before performing the operation as appropriate; they do *not* simply : do non-integer work and then cast the result. We don't have a way to name those two options for implementation: multi infix: ($x, $y --> Int) { Int($x) / Int($y) } multi infix: ($x, $y --> Int) { Int($x / $y) } So perhaps we need a way to name those two differently. And maybe there's a third: multi infix: ($x, $y --> Int) { Int(CALLER::infix:($x,$y)) } or maybe one uses a macro to get those semantics, since that latter is an infinite recursion if CALLER::infix: already happens to pick the Int returning variant. Oops... : Change spelling to taste (eg, they could be spelled : Int::Div/Int::Mod/Num::Div/Num::Mod instead), but I hope you get the : point of what I was saying. Assuming everything can be named with some kind of long name, the question is whether our current aliasing facilities are sufficient for remapping generic / and % operators, and creating convenience operators like idiv. I would guess so. The main question then is whether Standard Perl should provide such convenience operators, or pragmatic support for them. The other issue is how this relates to return-type multiple dispatch, and whether we support type inferencing, or require a pragma to say that / assumes Rat for its return type. Or another wacky approach would be to defer the choice until we know the actual use context and then do the division. Run-time type inferencing, as it were... I don't think that approach would necessarily imply full laziness--one could presumably evaluate the arguments up to the point of making the choice of which variant to call. Of course, if those arguments are waiting with bated breath to find out *their* type context, then we really are looking at type inferencing at run time, which transitively implies a great deal of implied laziness (and associated potential grief if done poorly). There's much to be said for a pragma that forces the issue: "Just gimme my Rats, darn it!" But I'm also still wondering whether a simpler approach is to declare that Num is a role that can encapsulate objects of class Int, Num, Rat, or Dec as necessary. There also a lot to be said for simple... Larry
[perl #41163] [PATCH] suppress uninitialized value warning in config/inter/yacc.pm
# New Ticket Created by "Lee Duhem" # Please include the string: [perl #41163] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41163 > This patch suppress some uninitialized value warning in config/inter/yacc.pm when use --maintainer option at configure. $ diffstat /tmp/yacc.patch yacc.pm |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: config/inter/yacc.pm === --- config/inter/yacc.pm(revision 16381) +++ config/inter/yacc.pm(working copy) @@ -89,7 +89,8 @@ # someday we might need to check $3 also. my ( $prog_major, $prog_minor, $prog_patch ) = ( $1, $2, $3 ); -my $prog_version = "$1.$2$3"; +$prog_patch = $3 ? $3 : ""; +my $prog_version = "$1.$2$prog_patch"; # is there a version requirement? my $req = $conf->options->get('bison_required');
Re: Numeric Semantics
On Tue, Jan 02, 2007 at 09:24:20AM -0800, Larry Wall wrote: : But I'm also still wondering whether a simpler approach is to declare : that Num is a role that can encapsulate objects of class Int, Num, : Rat, or Dec as necessary. There also a lot to be said for simple... Well, that's wrong several ways. It would be more like Num is a Scalar that is constrained to a Numeric role. But Scalars are mutable, and that plays havoc with the value semantics. How can you tell if two different numeric types are really holding the same value? There's no one-to-one correspondence between approximate types and exact types. You can pretend that a floater is a single value, but a given floater really represents a range of rational and irrational values. You'd really like Num to at least pretend it has value semantics though... :/ Larry
Re: Numeric Semantics
At 09:24 -0800 1/2/07, Larry Wall wrote: >But I'm also still wondering whether a simpler approach is to declare >that Num is a role that can encapsulate objects of class Int, Num, >Rat, or Dec as necessary. There also a lot to be said for simple... Simple. . . YES! but I'm in no position to help. Computer science has left me way behind. But I do a lot of computing and I do like perl 5. In fact, I use it on Mac OS neXt in preference to C or FORTRAN. I fully understand floats, integers, complex, vectors, and big numbers and I believe that's typical of folks who really use computers for computing. It would be nice if perl 6 would allow me, the user, to specify in advance just which numeric type I want. Incompatible usage would be an error that would be politely objected to by the compiler. How about a convention that integers begin with I, J, K, L, M, and N while others are floats? Perhaps those letters by themselves would imply that they are indexing quantities which should be assigned to hardware registers. Yeah, that's just to show how old I am. But why not an optional typdef-like facility in perl which would tell the compiler what I want? It could even be an O-O style instantiation. Separate sigl's, perhaps but some unicode specials - questionable. User-defined sigl's in a pragma? DIM statements? $Lynn / $Jill would be an integer divide using whatever arithmetic logic unit the machine in use provides. $Ross / $Todd would be done with the floating point processor. $Ross / $Lynn would convert $Lynn to a float and return a float. See FORTRAN conventions to continue. -- --> The greenhouse effect due to water vapor has never been fully modeled and weather forecasting remains irreducibly complex. It is clear that global warming is the act of an Intelligent Designer. <--
Re: Numeric Semantics
On Tue, Jan 02, 2007 at 11:22:22AM -0700, Doug McNutt wrote: : See FORTRAN conventions to continue. Well, I don't think FORTRAN implicit conventions will fly anymore, but basically I think I agree with you that different contexts will want to warp what they mean by "numeric". Leaving aside the whole mess of coercion before/after, OO and MD will mostly drive the decision of which operators to use for existing objects, so the warpage in a given context would be to select how you want new numeric objects created (possibly extended to select otherwise tied multis on the basis of their return type, but this can be viewed as an extension of creation semantics (unless it also picks coercion)). Anyway, there's already implicit in Perl 6 that a short name like Num is really an alias to a longer name like Num-6.0.3-STD. We could go slightly farther and say that by default Num is an alias to Flt, and Flt is the alias to the "largest convenient" floating point representation on this architecture. However, a given lexical scope could alias Num to anything else it likes, and while that would not influence the dispatch of any existing objects that came in from elsewhere, it would influence the operator used to create any new "Num" objects in the current context. So you could alias Num to Rat or Fix or Dec or whatever if you like in a given lexical scope. What this tells me, though, is that we need to be more explicit about the meaning of type names that are mentioned within role definitions. When a given role says "this method returns Num" it probably wants to be generic; that is, it wants to mean the Num defined at the time the role is composed, not the Num defined where the role is defined. Whether that policy should be in effect for all type names by default is a good question. (This is much like the virtualization of type names within methods that we already mandate, actually.) If so, then we need to decide the proper notation for "no I really do mean the Num type in scope where the role is defined". Or the default can go the other way, and then we'd need some way of saying that we do want Num to be implicitly parametric without having to pass it every time to the role composer. Well, that's mostly just a bunch of thinking out loud. Others should feel free to do likewise. But at some point it would be nice if the optimizer can figure out what the user actually expects to happen, which leads me to think that Num should eventually be mappable to a less-abstract type at compile time, as long as it matches the desired constraints of the user. I have this almost-tongue-in-cheek vision of a numeric type selector that works like modern font selection, where you say you want use Num :where<-15-3-*-*-fast-*-*->; and it gives you a numeric type with the appropriate constraints, and you don't care whether it's actually implemented as decimal strings, scaled integers or scaled floating point, as long as you get 15 digits altogether, 3 exact digits after the decimal point, and it's fast. :) Larry
[perl #41164] [BUG] 'make world' fails with msvc due to unresolved external
# New Ticket Created by Jerry Gay # Please include the string: [perl #41164] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=41164 > D:\usr\local\parrot\head>nmake world Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. "Compiling with:" xx.c cl -I.\include -nologo -GF -W3 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT - DNO_HASH_SEED -DUSE_SITECUSTOMIZE -Zi -DHAS_JIT -DI386 -I. -Fo xx.obj -c xx.c D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" docs D:\usr\local\perl\bin\perl.exe -MExtUtils::Command -e mkpath ops D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" src\dynpmc D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" src\dynoplibs D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" compilers\past D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" compilers\pge cd PGE\pmc && D:\usr\local\perl\bin\perl.exe D:\usr\local\parrot\head\to ols\build\dynpmc.pl generate codestring cd PGE\pmc && D:\usr\local\perl\bin\perl.exe D:\usr\local\parrot\head\to ols\build\dynpmc.pl compile codestring cd PGE\pmc && D:\usr\local\perl\bin\perl.exe D:\usr\local\parrot\head\to ols\build\dynpmc.pl linklibs codestring cd PGE\pmc && D:\usr\local\perl\bin\perl.exe D:\usr\local\parrot\head\to ols\build\dynpmc.pl copy --destination=D:\usr\local\parrot\head\runtime\parrot\d ynext codestring D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" compilers\tge D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" compilers\past-pm D:\usr\local\perl\bin\perl.exe -e "chdir shift @ARGV;system 'nmake', '-n ologo', @ARGV; exit $? >> 8;" compilers\json src\pdump.c src\packdump.c link -out:.\pdump.exe src\pdump.obj src\packdump.obj libparrot.lib o ldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32 .lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -nologo -nodefaultlib -debug -machine:x86 -debug Creating library .\pdump.lib and object .\pdump.exp src\disassemble.c link -out:.\disassemble.exe src\disassemble.obj libparrot.lib oldname s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib s hell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm .lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -nologo -nodefaultlib -debug -machine:x86 -debug src\pbc_info.c link -out:.\pbc_info.exe src\pbc_info.obj libparrot.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32 .lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib v ersion.lib odbc32.lib odbccp32.lib msvcrt.lib -nologo -nodefaultlib -debug - machine:x86 -debug src\pdb.c src\pdb.c(153) : warning C4013: 'IMCC_ast_init' undefined; assuming extern retur ning int link -out:.\pdb.exe src\pdb.obj libparrot.lib oldnames.lib kernel32.l ib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32 .lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -nologo -nodefaultlib -debug -machine:x8 6 -debug pdb.obj : error LNK2019: unresolved external symbol _IMCC_ast_init referenced in function _main .\pdb.exe : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. D:\usr\local\parrot\head>
[perl #41164] [BUG] 'make world' fails with msvc due to unresolved external
fixed in r16383
99 problems in Perl6: 32 and a question on number coercion
Hi everyone! I solved the (easy) problem 32, implementing gcd($a,$b). You can check the code in the repository or on the web[1] But while writing this I noticed that a function written as sub gcd(Int $a, Int $b) still accepts float/rational values in input. I think I read once that a variable of type Int would accept these kind of assignment but that the value would be coerced to the new type of the variable, i.e. my Int $a= 10.1 #=> 10 Could someone explain me what is the expected behaviour? [1] http://sial.org/pbot/22088 -- blog en: http://www.riffraff.info blog it: http://riffraff.blogsome.com jabber : rff.rff at gmail dot com
[svn:parrot-pdd] r16391 - trunk/docs/pdds/clip
Author: allison Date: Tue Jan 2 22:46:16 2007 New Revision: 16391 Modified: trunk/docs/pdds/clip/pdd22_io.pod Log: [pdd]: Adding API for async status objects, cleaning up some descriptions of I/O opcodes. Modified: trunk/docs/pdds/clip/pdd22_io.pod == --- trunk/docs/pdds/clip/pdd22_io.pod (original) +++ trunk/docs/pdds/clip/pdd22_io.pod Tue Jan 2 22:46:16 2007 @@ -233,13 +233,52 @@ =item get_fd - $I0 = $P1.'get_fd'() + $I0 = $P1.get_fd() Retrieves the UNIX integer file descriptor of a stream object. No asynchronous version. =back +=head2 Status Object PMC API + +=over 4 + +=item get_integer (vtable) + + $I0 = $P1 + +Returns an integer status for the status object, 1 for successful +completion, -1 for an error, and 0 while still running. [Discuss: This +is largely to preserve current expectations of -1 for an error. If we +move away from that, is there a better representation?] + +=item get_bool (vtable) + + if $P1 goto ... + +Returns a boolean status for the status object, C for successful +completion or successful work in progress, C for an error. + +=item error + + $P0 = $P1.error() + +Retrieves the error object from the status object, if the execution of +the asynchronous operation terminated with an error. The error object is +derived from Exception, and can be thrown from the callback. If there +was no error, or the asynchronous operation is still running, returns a +null PMC. + +=item return + + $P0 = $P1.return() + +Retrieves the return value of the asynchronous operation from the status +object. + +=back + =head2 I/O Opcodes The signatures for the asynchronous operations are nearly identical to @@ -251,8 +290,8 @@ The listing below says little about whether the opcodes return error information. For now assume that they can either return a status object, -or return nothing. Error handling is discussed more thoroughly in the -implementation section. +or return nothing. Error handling is discussed more thoroughly below in +L. =head2 I/O Stream Opcodes @@ -265,21 +304,25 @@ $P0 = open $S1 $P0 = open $S1, $S2 -Opens a stream object based on a file path in $S1 in read/write mode. The -optional string argument $S2 specifies the mode of the stream (read, write, -append, read/write, etc.), and returns a stream object. Currently the -mode of the stream is set with a string argument similar to Perl 5 -syntax, but a language-agnostic mode string is preferable, using 'r' for -read, 'w' for write, 'a' for append, and 'p' for pipe. +Opens a stream object based on a file path in $S1 and returns it. The +stream object defaults to read/write mode. The optional string argument +$S2 specifies the mode of the stream (read, write, append, read/write, +etc.). Currently the mode of the stream is set with a string argument +similar to Perl 5 syntax, but a language-agnostic mode string is +preferable, using 'r' for read, 'w' for write, 'a' for append, and 'p' +for pipe. The asynchronous version takes a PMC callback as an additional final argument. When the open operation is complete, it invokes the callback with two arguments: a status object and the opened stream object. -=item * +=item close + + close $P0 + close $P0, $P1 -C closes a stream object. It takes a single string object -argument and returns a status object. +Closes a stream object. It takes a single string object argument and +returns a status object. The asynchronous version takes an additional final PMC callback argument. When the close operation is complete, it invokes the callback, @@ -310,9 +353,22 @@ =over 4 -=item * +=item print + + print $I0 + print $N0 + print $S0 + print $P0 + print $P0, $I1 + print $P0, $N1 + print $P0, $S1 + print $P0, $P1 + print $P0, $I1, $P2 + print $P0, $N1, $P2 + print $P0, $S1, $P2 + print $P0, $P1, $P2 -C writes an integer, float, string, or PMC value to a stream. It +Writes an integer, float, string, or PMC value to a stream. It writes to standard output by default, but optionally takes a PMC argument to select another stream to write to. @@ -320,10 +376,14 @@ argument. When the print operation is complete, it invokes the callback, passing it a status object. -=item * +=item printerr + + printerr $I0 + printerr $N0 + printerr $S0 + printerr $P0 -C writes an integer, float, string, or PMC value to standard -error. +Writes an integer, float, string, or PMC value to standard error. There is no asynchronous variant of C. [It's just a shortcut. If they want an asynchronous version, they can use C.] @@ -334,21 +394,28 @@ =over 4 -=item * +=item read -C retrieves a specified number of bytes from a stream into a -string. [Note this is bytes, not codepoints.] By default it reads from -standard input, but it also takes an alternate stream object source as -an optional argument. + $S0 = read $I1 + $S0 = read $P1, $I2 + $P0 = read $P1, $I2, $P
[svn:parrot-pdd] r16392 - in trunk: . docs/pdds docs/pdds/clip
Author: allison Date: Tue Jan 2 22:56:54 2007 New Revision: 16392 Added: trunk/docs/pdds/pdd22_io.pod - copied unchanged from r16391, /trunk/docs/pdds/clip/pdd22_io.pod Removed: trunk/docs/pdds/clip/pdd22_io.pod Changes in other areas also in this revision: Modified: trunk/MANIFEST Log: [pdd]: Moving the I/O PDD out of the clip directory to "bless" it.