Re: Time::Local

2005-07-05 Thread Dave Whipp
Larry Wall wrote: The time function always returns the time in floating point. I don't understand why time() should return a numeric value at all. Surely it should return a DateTime (or Time) object. Using epochs in a high level language seems like a really bad thing to be doing. If I want

Re: Time::Local

2005-07-05 Thread Dave Whipp
Douglas P. McNutt wrote: At 10:55 -0700 7/5/05, Dave Whipp wrote: I don't understand why time() should return a numeric value at all. Some of us like to use epoch time, as an integer, to create unique file names which sort "right" in a shell or GUI. You can use "

Re: Time::Local

2005-07-05 Thread Dave Whipp
Darren Duncan wrote: The object should not store anything other than this single numerical value internally (smart caching of conversions aside). I think we can all either agree with that, or dont-care it. The internal implementation is an implementation issue (or library). It doesn't need t

Re: Time::Local -- and lexical scope

2005-07-05 Thread Dave Whipp
Dave Whipp wrote: You can use "{time - $epoch}" or "{time.as<%d>}" or "{int time}". (That last one is not "{+time}", because that would be a floating-point value, not an integer). I was thinking: an epoch is just a time, and "int time

Re: File.seek() interface

2005-07-07 Thread Dave Whipp
Wolverian wrote: Or maybe we don't need such an adverb at all, and instead use $fh.seek($fh.end - 10); I'm a pretty high level guy, so I don't know about the performance implications of that. Maybe we want to keep seek() low level, anyway. Any thoughts/decisions? We should approach thi

Re: Hackathon notes

2005-07-08 Thread Dave Whipp
Rod Adams wrote: multi method foo#bar (Num x) {...} multi method foo#fiz (String x) {...} $y = 42; $obj.foo#fiz($y); # even though $y looks like a Num $obj.foo($z); # let MMD sort it out. Having additional tags might also give us something to hang priority traits off: "fo

Re: Perl 6 Summary for 2005-07-05 through 2005-07-12

2005-07-13 Thread Dave Whipp
Damian Conway wrote: Important qualification: Within a method or submethod, C<.method> only works when C<$_ =:= > $?SELF>. C<.method> is perfectly legal on *any* topic anywhere that $?SELF doesn't exist. Just to be clear, this includes any method/submethod with an explicitly named invo

Re: Optimization pipeline

2005-07-14 Thread Dave Whipp
Yuval Kogman wrote: - optimizers stack on top of each other - the output of each one is executable - optimizers work in a coroutine, and are preemptable - optimizers are small - optimizers operate with a certain section of code in mind > ... Optimizers

Re: Referring to package variables in the default namespace in p6

2005-07-21 Thread Dave Whipp
"TSa (Thomas Sandlaß)" wrote: Here your expectations might be disappointed, sorry. The non-symbolic form $*Main::foo = 'bar' creates code that makes sure that the lhs results in a proper scalar container. The symbolic form might not be so nice and return undef! Then undef = 'bar' of course let'

Re: Messing with the type heirarchy

2005-07-31 Thread Dave Whipp
Luke Palmer wrote: Everything that is a Num is a Complex right? Not according to Liskov But this is one of the standard OO >>paradoxes, and we're hoping roles are the way out of it. Well, everything that is a Num is a Complex in a value-typed world, which Num and Complex are in. I do

"set" questions -- Re: $object.meta.isa(?) redux

2005-08-10 Thread Dave Whipp
Luke Palmer wrote: A new development in perl 6 land that will make some folks very happy. There is now a Set role. Among its operations are (including parentheses): (+) Union (*) Intersection (-) Difference (<=) Subset (<) Proper subset (>=) Superset (>)

Re: Demagicalizing pairs

2005-08-24 Thread Dave Whipp
I've been trying to thing about how to make this read right without too much line noise. I think Lukes keyword approach ("named") is on the right track. If we want named params at both start and end, then its bound to be a bit confusing. But perhaps we can say that they're always at the end --

Parsing indent-sensitive languages

2005-09-08 Thread Dave Whipp
If I want to parse a language that is sensitive to whitespace indentation (e.g. Python, Haskell), how do I do it using P6 rules/grammars? The way I'd usually handle it is to have a lexer that examines leading whitespace and converts it into "indent" and "unindent" tokens. The grammer can then

Re: Parsing indent-sensitive languages

2005-09-08 Thread Dave Whipp
Damian Conway wrote: Alternatively, you could define separate rules for the three cases: { state @indents = 0; rule indent { ^^ $:=(\h*) { $ = expand_tabs($).chars } <( $ > @indents[-1] )> { let @indents = (@indents, $) }

Re: skippable arguments in for loops

2005-09-29 Thread Dave Whipp
Luke Palmer wrote: Joked? Every other language that has pattern matching signatures that I know of (that is, ML family and Prolog) uses _. Why should we break that? IMO, it's immediately obvious what it means. Something tells me that in signature unification, "undef" means "this has to be un

Look-ahead arguments in for loops

2005-09-29 Thread Dave Whipp
Imagine you're writing an implementation of the unix "uniq" function: my $prev; for grep {defined} @in -> $x { print $x unless defined $prev && $x eq $prev; $prev = $x; } This feels clumsy. $prev seems to get in the way of what I'm trying to say. Could we imbue optional b

Re: Look-ahead arguments in for loops

2005-09-30 Thread Dave Whipp
Damian Conway wrote: Rather than addition Yet Another Feature, what's wrong with just using: for @list ¥ @list[1...] -> $curr, $next { ... } ??? There's nothing particularly wrong with it -- just as ther's nothing particularly wrong with any number of other "we don't need thi

Re: Exceptuations

2005-10-05 Thread Dave Whipp
Luke Palmer wrote: Of course, exactly how this "public interface" is declared is quite undefined. Reading this thread, I find myself wondering how a resumable exception differs from a dynamically scropted function. Imagine this code: sub FileNotWriteable( Str $filename ) { die "can't write

Re: zip: stop when and where?

2005-10-06 Thread Dave Whipp
Luke Palmer wrote: zip :: [a] -> [b] -> [(a,b)] It *has* to stop at the shortest one, because it has no idea how to create a "b" unless I tell it one. If it took the longest, the signature would have looked like: zip :: [a] -> [b] -> [(Maybe a, Maybe b)] Anyway, that's just more of t

$value but lexically ...

2005-10-06 Thread Dave Whipp
C properties get attached to a value, and are available when the value is passed to other functions/ etc. I would like to be able to define a property of a value that is trapped in the lexical scope where it is defined. The example that set me thinking down this path is sub foo( $a, ?$b = rand

Re: Sane (less insane) pair semantics

2005-10-10 Thread Dave Whipp
Austin Hastings wrote: How about "perl should DWIM"? In this case, I'm with Juerd: splat should pretend that my array is a series of args. So if I say: foo [EMAIL PROTECTED]; or if I say: foo([EMAIL PROTECTED]); I still mean the same thing: shuck the array and get those args out here, even

Re: Proposal to make class method non-inheritable

2005-10-11 Thread Dave Whipp
Stevan Little wrote: I would like to propose that class methods do not get inherited along normal class lines. One of the things that has annoyed me with Java is that it's class methods don't inherit (dispatch polymorphically). This means that you can't apply the "template method" pattern to

Re: Proposal to make class method non-inheritable

2005-10-11 Thread Dave Whipp
Stevan Little wrote: David, ... If you would please give a real-world-useful example of this usage of class-methods, I am sure I could show you, what I believe, is a better approach that does not use class methods. ... The example I've wanted to code in Java is along the lines of: public

Thoughs on Theory.pm

2005-10-13 Thread Dave Whipp
(ref: http://svn.openfoundry.org/pugs/docs/notes/theory.pod) >theory Ring{::R} { >multi infix:<+> (R, R --> R) {...} >multi prefix:<-> (R --> R){...} >multi infix:<-> (R $x, R $y --> R) { $x + (-$y) } >multi infix:<*> (R, R --> R) {...} ># on

Re: Thoughs on Theory.pm

2005-10-13 Thread Dave Whipp
David Storrs wrote: While I like the idea, I would point out that 1000 tests with randomly generated data are far less useful than 5 tests chosen to hit boundary conditions. I come from a hardware verification background. The trend in this industry is driven from the fact that the computer

Re: Standard library for perl6? (graphical primitives)

2005-10-18 Thread Dave Whipp
Markus Laire wrote: I'm not completely sure if it would be worth the trouble to support only most primitive graphical commands "in core", (no windows, etc..), and leave the rest to the modules (or to the programmer). To a large extent, I'd want to leave most details to modules, etc. But what

Re: new sigil

2005-10-21 Thread Dave Whipp
Luke Palmer wrote: As I mentioned earlier, most programmers in a corporate environment >> have limited access to system settings. And in those kinds of corporate environments, you're not going to be working with any code but code written in-house. Which means that nobody is going to be using L

Re: Test Case: Complex Numbers

2005-11-14 Thread Dave Whipp
Jonathan Lang wrote: In the hypothetical module that I'm describing, the principle value approach _would_ be used - in scalar context. The only time the "list of all possible results" approach would be used would be if you use list context. If you have no need of the list feature, then you don

Re: \x{123a 123b 123c}

2005-11-22 Thread Dave Whipp
Larry Wall wrote: And there aren't that many regexish languages anyway. So I think :syntax is relatively useless except for documentation, and in practice people will almost always omit it, which makes it even less useful, and pretty nearly kicks it over into the category of multiplied entities

Re: relational data models and Perl 6

2005-12-15 Thread Dave Whipp
Darren Duncan wrote: As an addendum to what I said before ... ... I would want the set operations for tuples to be like that, but the example code that Luke and I expressed already, with maps and greps etc, seems to smack too much of telling Perl how to do the job. I don't want to have to us

Re: Table of Perl 6 "Types"

2006-01-12 Thread Dave Whipp
>>(perhaps this discussion belongs on p6l) > It sure does;) (this reply moved to p6l) [EMAIL PROTECTED] wrote: Dave Whipp wrote: An Int is Enumerable: each value that is an Int has well defined succ and pred values. Conversely, a Real does not -- and so arguably should not support t

Re: Table of Perl 6 "Types"

2006-01-12 Thread Dave Whipp
Rob Kinyon wrote: I wouldn't see a problem with defining a "Real" role that has a fairly sparse set of operations. Afterall, a type that does support ++ and -- (e.g. Int, Num) could easily "does Enumerable" if it wants to declare that it supports them. What about the scripty-doo side of Perl6?

Pattern matching and "for" loops

2006-01-13 Thread Dave Whipp
Today I wrote some perl5 code for the umpteenth time. Basically: for( my $i=0; $i< $#ARGV; $i++ ) { next unless $ARGV[$i] eq "-f"; $i++; $ARGV[$i] = absolute_filename $ARGV[$i]; } chdir "foo"; exec "bar", @ARGV; I'm trying to work out if there's a clever perl6 way to wri

Re: Pattern matching on arrays and "for" loops

2006-01-13 Thread Dave Whipp
Luke Palmer wrote: On 1/13/06, Dave Whipp <[EMAIL PROTECTED]> wrote: Would this actually work, or would it stop at the first elem that doesn't match ("-f", ::Item)? If by "stop" you mean "die", yes it would stop. not what I wanted :-( Is there s

something between "state" and "my"

2006-02-02 Thread Dave Whipp
(from p6i) Larry Wall wrote: On Thu, Feb 02, 2006 at 07:12:08PM +0100, Leopold Toetsch wrote: : >... Anyway, : >the P6 model of "state" is more like a persistent lexical than like : >C's static. : : Sorry for my dumb question - what's the difference then? (Besides that C : dosn't have closur

Re: something between "state" and "my"

2006-02-03 Thread Dave Whipp
Larry Wall wrote: But that's just my current mental model, which history has shown is subject to random tweakage. And maybe "env $+result" could be a special squinting construct that does create-unless-already-created. Doesn't feel terribly clean to me though. If we stick with the + twigil alw

Re: comment scope

2006-03-14 Thread Dave Whipp
Ruud H.G. van Tol wrote: Perl6 could introduce (lexical, nestable) comment scope. In P5 I often us q{...} in void context -- P6 seems to be attaching tags to the quote operator, so q:comment{...} might fall out naturally.

Capture Object: why no verb?

2006-04-17 Thread Dave Whipp
Reading about capture objects, I see that they represent an arglist, and the the object to which you going to send those args. What is doesn't capture is the method name (the verb) that's being called. This feels like a slightly strange ommission. Compare: $message = &Shape::draw.prebind( x

Re: Capture Object: why no verb?

2006-04-22 Thread Dave Whipp
Audrey Tang wrote: > Hm, Perl 6 actually has two different ways of putting Capture to some > Code object... Following yesterday's P6AST draft I'll call them Call and > Apply respectively: > > moose($obj: 1, 2); # this is Call > &moose.($obj: 1, 2); # this is Apply > > elk(named

Why does p6 always quote non-terminals?

2006-06-27 Thread Dave Whipp
I was reading the slides from PM's YAPC::NA, and a thought drifted into my mind (more of a gentle alarm, actually). One of the examples struck me: rule parameter_list { [ , ]* } Its seems common in the higher layers of a grammar that there are more non-terminal than terminals in each rule, so

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Dave Whipp
Darren Duncan wrote: Assuming that all elements of $a and $b are themselves immutable to all levels of recursion, === then does a full deep copy like eqv. If at any level we get a mutable object, then at that point it turns into =:= (a trivial case) and stops. ( 1, "2.0", 3 ) === ( 1,2,3

Re: === and array-refs

2006-08-17 Thread Dave Whipp
David Green wrote: No, look at the example I've been using. Two arrays (1, 2, [EMAIL PROTECTED]) and (1, 2, [EMAIL PROTECTED]) clearly have different (unevaluated) contents. "eqv" only tells me whether they have the same value (when @x and @y are evaluated). That's a different question --

Re: Mutability vs Laziness

2006-09-25 Thread Dave Whipp
Aaron Sherman wrote: It seems to me that there are three core attributes, each of which has two states: Mutability: true, false Laziness: true, false Ordered: true, false I think there's a 4th: exclusivity: whether or not duplicate elements are permitted/exposed (i.e. the differe

Re: "Don't tell me what I can't do!"

2006-10-02 Thread Dave Whipp
Smylers wrote: use strict; That's different: it's _you_ that's forbidding things that are otherwise legal in your code; you can choose whether to do it or not. Which suggests that the people wanting to specify the restrictions are actually asking for a way to specify additional strictures fo

Re: "Don't tell me what I can't do!"

2006-10-02 Thread Dave Whipp
Jonathan Lang wrote: Before we start talking about how such a thing might be implemented, I'd like to see a solid argument in favor of implementing it at all. What benefit can be derived by letting a module specify additional strictures for its users? Ditto for a role placing restrictions on the

Re: "Don't tell me what I can't do!"

2006-10-02 Thread Dave Whipp
Jonathan Lang wrote: Dave Whipp wrote: Or we could view it purely in terms of the design of the core "strict" and "warnings" modules: is it better to implement them as centralised rulesets, or as a distributed mechanism by which "core" modules can register modul

Re: Synposis 26 - Documentation [alpha draft]

2006-10-08 Thread Dave Whipp
Damian Conway wrote: > Delimited blocks are bounded by C<=begin> and C<=end> markers... > ...Typenames that are entirely lowercase (for example: C<=begin > head1>) or entirely uppercase (for example: C<=begin SYNOPSIS>) > are reserved. I'm not a great fan of this concept of "reservation" when the

Re: Non-integers as language extensions (was Re: Numeric Semantics)

2007-01-04 Thread Dave Whipp
Darren Duncan wrote: For example, the extra space of putting them aside will let us expand them to make them more thorough, such as dealing well with exact vs inexact, fixed vs infinite length, fuzzy or interval based vs not, caring about sigfigs or not, real vs complex vs quaternon, etc. I

The S13 "is commutative" trait

2007-01-16 Thread Dave Whipp
Synopsys 13 mentions an "is commutative" trait in its discussion of operator overloading syntax: > Binary operators may be declared as commutative: > >multi sub infix:<+> (Us $us, Them $them) is commutative { >myadd($us,$them) } A few questions: Is this restricted to only binary op

Re: Numeric Semantics

2007-01-22 Thread Dave Whipp
Doug McNutt wrote: At 00:32 + 1/23/07, Smylers wrote: % perl -wle 'print 99 / 2' 49.5 I would expect the line to return 49 because you surely meant integer > division. Perl 5 just doesn't have a user-available type integer. I'd find that somewhat unhelpful. Especially on a one-liner, l

Coercion of non-numerics to numbers

2007-03-05 Thread Dave Whipp
I was wondering about the semantics of coercion of non-numbers, so I experimented with the interactive Pugs on feather: pugs> +"42" 42.0 pugs> +"x42" 0.0 I assume that pugs is assuming "no fail" in the interactive environment. However, Is "0.0" the correct answer, or should it be one of "undef

Re: explicit line termination with ";": why?

2007-05-15 Thread Dave Whipp
Jonathan Lang wrote: Close. I'm thinking "added functionality for semicolon alternatives" rather than the "replace the semicolon" stunt that Semi::Semicolons pulls. In particular, as long as there's no ambiguity between prefix: and postfix:, I think that it would be quite useful for postfix: t

Re: = at Start of Line ... solution is simple

2007-06-16 Thread Dave Whipp
Darren Duncan wrote: Given this, there is an obvious (to me) solution for pod blocks in the middle of expressions like: my $foo = $bar; As the example shows, and I believe best practices espouse, you *indent* the code line with a leading =. I'd agree that indentation is good for reada

Re: xml and perl 6

2007-11-29 Thread Dave Whipp
cdumont wrote: > By listening to you all, we shouldn't even think to implement file access... I think I'd argue that most file-access features should indeed be considered "non-core". This doesn't mean that we shouldn't think to implement them -- or that they wouldn't be part of almost every Perl-

Re: xml and perl 6

2007-11-29 Thread Dave Whipp
cdumont wrote: > By listening to you all, we shouldn't even think to implement file access... I think I'd argue that most file-access features should indeed be considered "non-core". This doesn't mean that we shouldn't think to implement them -- or that they wouldn't be part of almost every Perl-

Re: Concerns about "{...code...}"

2007-12-21 Thread Dave Whipp
Larry Wall wrote: As for the Q base form, it's not really there so much for end-use, For an operator not intended for end use, it has a remarkable low Huffman rank...

Re: Concerns about "{...code...}"

2007-12-21 Thread Dave Whipp
Chas. Owens wrote: On Dec 21, 2007 4:51 PM, Dave Whipp <[EMAIL PROTECTED]> wrote: Larry Wall wrote: As for the Q base form, it's not really there so much for end-use, For an operator not intended for end use, it has a remarkable low Huffman rank... But since it will be combined w

Sequential bias in S04 (and Perl6 in general)

2008-01-02 Thread Dave Whipp
I was reading Synopsis 4 with regards to multi core programming. It seems to be infused with a bias towards non-parallel models of computation. Concurrently appears to be an add-on feature -- whereas we should have a mindset that explicit sequential constraints are the add-on feature. Two sta

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-03 Thread Dave Whipp
Moritz Lenz wrote: You can achieve that with the "hyper" list-op (see S02). Also note that an optimizer is free to automatically add the "hyper" list op if it can prove that the executed block has no side effects. Yes, there are some places where things are better than others, which is why I

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-04 Thread Dave Whipp
Luke Palmer wrote: forall was about concurrency, not order of evaluation. There is a difference between running in an arbitrary order serially and running in parallel. for %bag { .say; } If the bag had elements "hello", "world", I think printing: helworld lo Would defi

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-04 Thread Dave Whipp
Mark J. Reed wrote: Am I the only one having bad flashbacks to Occam, here? (Transputing Will Change Everything!) My $0.02, FWIW: Concurrency is surprising. Humans don't think that way. And programs aren't written that way - any program represented as a byte stream is inherently sequential i

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-04 Thread Dave Whipp
Larry Wall wrote: It's really, really easy to misdesign a computer language by overemphasizing one particular design dimension to the detriment of others. I agree that adding a parallel "forall" (and similar statements) via a pragma will be easy if the appropriate underlying machinery is ther

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-04 Thread Dave Whipp
Larry Wall wrote: my hope is that we can delegate locking entirely to the innards of the implementation and never mention it at all on the language level. Hmm, sounds to me analogous to hoping that type inference will avoid the need to expose type-annotations at the language level (synchroniz

S02 interpolation of entire hashes

2008-01-07 Thread Dave Whipp
The tests in S02 L appear to assume that an interpolated hash renders its keys in a sorted order. But this property doesn't seem to be stated in the text. Is it true that the keys are always sorted for interpolation? (is it possible, in P6, for hash keys to not be comparable?)

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-11 Thread Dave Whipp
Matthew Walton wrote: I wouldn't agree with that at all. I think of arrays as ordered constructs, so I'd want the default iteration over my array to happen in the order of the indices. I guess that depends on whether you think of the array as a list or as a ram. I know that a group at microso

Can assignment meta-operator be combined with feed operators?

2008-01-11 Thread Dave Whipp
S06 says that we need to say "eager" if (@in === @out). So: @data ==> eager map { $^x + 1 } ==> @data. Is it possible to modify a feed operator using the assignment meta-operator described in S02 and, if so, is the "eager" implict? @data ==>= map { $_ + 1 };

Re: Can assignment meta-operator be combined with feed operators?

2008-01-11 Thread Dave Whipp
Larry Wall wrote: As for assignment-op forms, in the current "STD" grammar, feeds are not currently even considered operators, but statement separators, so there is no possibility of using them in an assignment metaoperator (or any other metaoperator, for that matter). Feeds as a reduction cou

S12 delegation ("handles" trait)

2008-04-18 Thread Dave Whipp
I noted Jonathan Worthington's work implementing the "handles" trait for delegation through attributes, and was a bit surprised to see that it is defined (S12/delegation) to use strings instead of method signatures -- I had thought that perl6 was attempting to be symbolic in places where perl5

Re: given vs for

2008-04-25 Thread Dave Whipp
Mark J. Reed wrote: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should "given @foo {...}" alias to $_, or @_?

Re: given vs for

2008-04-25 Thread Dave Whipp
Smylers wrote: Dave Whipp writes: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should "given @foo {...}" alias to $_, or @_? I'd expect it to alias to C<$_>, on the grounds that everything always aliases to C<$

Re: given vs for

2008-04-25 Thread Dave Whipp
Mark J. Reed wrote: The topic should always be $_ unless explicitly requested differently via the arrow. Now in the case of for, it might be nice if @_ bound to the entire collection being iterated over (if any)... As a perl5-ism: sub foo { say @_; } ... given (@bar) { when ... { &foo }

Re: First look: Advanced Polymorphism whitepaper

2008-05-01 Thread Dave Whipp
Brandon S. Allbery KF8NH wrote: But there *is* some commonality there, to the extent that both are motion. This is the kind of thing that spawned this discussion, in fact: if what matters is motion, there is no reason *not* to substitute one for the other. { draw $gun }: makes a big differ

Re: assignable mutators (S06/Lvalue subroutines)

2008-05-27 Thread Dave Whipp
TSa wrote: class Length { has Num $.mm is rw = 0; method inch { yield $inch = $.mm * 25.4; self.mm = $inch / 25.4; } } Would you regard that as elegant? That looks functionally incorrect to my eyes: if the caller resumes at the time

Re: assignable mutators (S06/Lvalue subroutines)

2008-05-27 Thread Dave Whipp
TSa wrote: TSa wrote: class Length { has Num $.mm is rw = 0; method inch { yield $inch = $.mm * 25.4; self.mm = $inch / 25.4; } } Would you regard that as elegant? That looks functionally incorrect to my eyes: if the caller resumes a

Re: Fatal/autodie exception hierarchies for Perl 5

2008-06-04 Thread Dave Whipp
Larry Wall wrote: On Wed, Jun 04, 2008 at 10:42:33AM -0400, Mark J. Reed wrote: : However, I think we are now officially *way* off topic for Perl6... Not really--a Klingon army is a *parallel* processor, and just because one Klingon dies doesn't mean the whole army should suddenly die too. Tradi

Re: meta_postfix:<*>

2008-07-15 Thread Dave Whipp
Jon Lang wrote: So you're suggesting that A op* n should map to [op] A xx n I don't think that that mapping works for Thomas' proposal of a repetition count on post-increment operator. I.e. $a ++* 3 is not the same as [++] $a xx 3 (which I think is a syntax error) and also not

how much detail can I get from caller.want?

2008-08-29 Thread Dave Whipp
Lets say I want to find the 5th smallest element in an array. I might write: @array.sort.[4]; How does the implementation of the sort function know that I just want to 5th item (and thus choose an appropriate optimization)? Obviously the function could be told that it's caller wants 5 values

Re: S16: chown, chmod

2008-11-21 Thread Dave Whipp
The restriction of chown to the superuser is a property of the OS, not the files. The example from the pod is: use POSIX qw(sysconf _PC_CHOWN_RESTRICTED); my $can_chown_giveaway = not sysconf(_PC_CHOWN_RESTRICTED); Thinking about it, perhaps that means that it's a method on $*OS. The use of fil

Re: S16: chown, chmod

2008-11-21 Thread Dave Whipp
Larry Wall wrote: On Fri, Nov 21, 2008 at 11:46:48AM -0800, dpuu wrote: : before I attempt to change the POD, would this wording be appropriate? It's a good first whack, though we might want to think about making it a little less P5ish/Unixish in changing a list of files, and rely instead of one

Re: S16: chown, chmod

2008-11-25 Thread Dave Whipp
Brandon S. Allbery KF8NH wrote: Still misunderstanding, I think. Yes, it will fail anyway, but in the general case you're checking to see if as a privileged process it is safe to operate on a given file. I'd actually been thinking that one would use the check in the opposite direction: if

Re: how to write literals of some Perl 6 types?

2008-12-06 Thread Dave Whipp
Carl Mäsak wrote: Paul (>): I can't find anything in the existing synopses about Blobs. Probably looking in the wrong place, sorry. Re-reading that, a slightly tangent (though still on topic, I hope) thought come to mind. The definition of the M

Re: Working with files wish list

2008-12-15 Thread Dave Whipp
Leon Timmermans wrote: On Mon, Dec 15, 2008 at 5:43 PM, Richard Hainsworth wrote: a) I am fed up with writing something like open(FP, ">${fname}_out.txt") or die "Cant open ${fname}_out.txt for writing\n"; The complex definition of the filename is only to show that it has to be restated ident

rfc: The values of a junction

2009-01-05 Thread Dave Whipp
I spent a fair amount of time with Rakudo over the holiday break (see http://dave.whipp.name/sw/perl6 for the writeup). I was generally impressed with both the language and its implementation. There were, unsurprisingly, a bunch of things missing. Some of these were things that are in the spec

Re: rfc: The values of a junction

2009-01-05 Thread Dave Whipp
That doesn't solve the general problem: my $junc = any -4 .. Inf; my @domain = -Inf .. 4; my @values = @domain |==| $junc; say @values.perl >>> [ -4 .. 4 ] How do you code that using "grep"? From: Daniel Ruoso To: Dave W

Re: rfc: The values of a junction

2009-01-05 Thread Dave Whipp
Daniel Ruoso wrote: my $concrete_value = max $junc_value.grep: { $^score < 21 }; In the general case, both the junction and the domain may be infinite: my @domain = -Inf .. 3; my $junc = any -4 .. Inf; my @values = @domain |==| $junc; say @values.perl "[-4..3]" Handling all the variation

Re: returning one or several values from a routine

2009-01-06 Thread Dave Whipp
Daniel Ruoso wrote: Hmm... I think that takes the discussion to another level, and the question is: "what does a capture returns when coerced to a context it doesn't provide a value for?" I'd like to take one step further, and ask what it is that introduced capture semantics in the first pl

Re: returning one or several values from a routine

2009-01-07 Thread Dave Whipp
Jon Lang wrote: I believe that we already have a signature creation operator, namely ":( @paramlist )". Yes, sorry, I missed that. > ... Regardless, the magic that makes this work would be the ability to assign a flat list of values to a signature. Is this wise? We already have the abilit

Re: [PATCH] Add .trim method

2009-01-12 Thread Dave Whipp
Ovid wrote: $string.trim(:leading<0>); $string.trim(:trailing<0>); Setting leading or trailing to false (they default to true) would result in either leading or trailing whitespace not being trimmed Alternatively, those could be ltrim() and rtrim(). If you need to dynamically de

Re: design of the Prelude (was Re: Rakudo leaving the Parrot nest)

2009-01-20 Thread Dave Whipp
Darren Duncan wrote: 1. What we *should* be doing with the Prelude, like with STD.pm, is write under the assumption that the implementation is also written in Perl 6. We should write the Prelude in as declarative a manner as possible, saying *what* we want to happen rather than how, such as

Re: design of the Prelude (was Re: Rakudo leaving the Parrot nest)

2009-01-22 Thread Dave Whipp
Darren Duncan wrote: Dave Whipp wrote: sub sqrt(Num where { 0 <= $_ <= Real::Max } $x) { (0..$x/2 :by(Real::Epsilon)).min: { abs $x - $^candidate ** 2 } } So do you really mean "as declarative a manner as possible"? Or would you consider this example to go beyond "

Re: RFD: Built-in testing

2009-01-22 Thread Dave Whipp
Moritz Lenz wrote: A few months ago Larry proposed to add some testing facilites to the language itself, because we want to culturally encourage testing, and because the test suite defines the language, so we need to specify the behaviour of our testing facilities anyway. If we're going to reva

Re: RFD: Built-in testing

2009-01-22 Thread Dave Whipp
Moritz Lenz wrote: $x == 1e5 :ok('the :ok makes this is a test'); I can't help feeling that there's an end-weight problem here: The fact that it is a test is the essence of statement. If we're thinking of it as a library, then the MMD way of thinking might be appropriate: we know it'

Re: design of the Prelude (was Re: Rakudo leaving the Parrot nest)

2009-01-23 Thread Dave Whipp
Darren Duncan wrote: I don't quite follow you. Are you saying your version of sqrt is an implicit declaration; maybe I don't understand how that differs from an explicit definition in this case? In any event, right at this moment I can't think of an answer to your question. Go ahead with wh

Re: RFD: Built-in testing

2009-01-23 Thread Dave Whipp
Timothy S. Nelson wrote: method foo() does assume { ... } method bar() does ensure { ... } Is "ensure" equivalent to the "assert" that you describe above? Yes. "does ensure" was meant to be an englishification of "postcondition"; and "does assume" is "precondition". From the perspec

Re: RFD: Built-in testing

2009-01-23 Thread Dave Whipp
Larry Wall wrote: On Fri, Jan 23, 2009 at 08:01:14AM -0800, Dave Whipp wrote: For example, I could conceive of a trait: ok foo, :broken which might downgrade the error to a warning on rakudo, but not on other implementations. On the surface that seems like a good idea, and pugs started

Re: RFD: Built-in testing

2009-01-23 Thread Dave Whipp
Larry Wall wrote: module MyTests { sub group1 { ok foo :name; ## Q - would a label be better? } } >> ## Elsewhere >> MyTests.group1.test_foo is also broken; I guess I don't see offhand what you're trying to do with that. ... We must keep a clean separation between code t

Re: RFD: Built-in testing

2009-01-23 Thread Dave Whipp
jerry gay wrote: i don't understand the drive to have unique test identifiers. we don't have unique identifiers for every code statement, or every bit of documentation. why are tests so important/special/different that each warrants a unique id? that aside, this functionality sounds like it can

Re: r25200 - docs/Perl6/Spec t/spec

2009-02-05 Thread Dave Whipp
Jon Lang wrote: Pattern to split on (used with -a). Substitutes an expression for the default split function, which is C<{split ' '}>. Accepts unicode strings (as long as Should the default pattern be ' ', or should it be something more like /\s+/? // ?

Re: The use of roles in S16 (Was: Re: r25328 - docs/Perl6/Spec)

2009-02-17 Thread Dave Whipp
Daniel Ruoso wrote: Maybe I'm thinking sideways again, but I haven't thought of "open" as being a method of any IO object, because usually "open" is the thing that gets you an IO Object. I'd expect the plain "open" to be really a sub (maybe a "is export" method in the generic IO role), that doe

Re: Temporal revisited

2009-02-20 Thread Dave Whipp
I'm getting a bit lost following precisely what's being proposed. What I'm sort of feeling is that there are two fundamental immutable types needed: Instants and Durations: multi sub infix:<-> (Instant, Instant --> Duration) multi sub infix:<+> (Instant, Duration --> Instant) multi sub in

  1   2   3   >