Re: DBI v2 - The Plan and How You Can Help

2005-07-04 Thread Sam Vilain
Darren Duncan wrote: 3. Redefine prepare() and execute() such that the first is expressly for activities that can be done apart from a database (and hence can also be done for a connection handle that is closed at the time) while all activities that require database interaction are deferred to

Re: DBI v2 - The Plan and How You Can Help

2005-07-04 Thread Sam Vilain
Darren Duncan wrote: Okay, considering that using the same name prepare() like this may confuse some people, here is a refined solution that uses 3 methods instead; please disregard any contrary statements that I previously made: I think I'm beginning to like it. Allow me to suggest one or tw

Re: Time::Local

2005-07-05 Thread Sam Vilain
Darren Duncan wrote: Actually, there was a big oversight in my last message. It does not handle approximate or relative dates, such as when you don't know the details. FWIW, this is handled by DateTime::Incomplete, and also will be natively supported by Date::Gregorian. You're describing wit

Re: Time::Local

2005-07-05 Thread Sam Vilain
Craig DeForest wrote: Using the TAI epoch of 1958-01-01 00:00:00 has several advantages: - TAI is recognized by international standards-setting bodies (BIPM). - Perl6 will then shake out the 31-bit time rollover a full 12 years before I like this in principle, however I wonder of the

Re: DBI v2 - The Plan and How You Can Help

2005-07-06 Thread Sam Vilain
Maxim Sloyko wrote: But this is not the point. The point was that usage of some file with passwords by *DEFAULT* is not the way to go, IMHO. It raises more problems than it solves. Can you give an example of such a problem that wasn't already there? Just to be clear, the file would only need

Re: Dependency Injection

2005-07-06 Thread Sam Vilain
Piers Cawley wrote: Then the harness that actually sets up the application would simply do use Logger::DBI :dsn<...>, :user<...>, :password<> and Logger::DBI would install itself as the default Logger class. The question is, how does one write Injected to make this work? Or what features

Re: DBI v2 - The Plan and How You Can Help

2005-07-11 Thread Sam Vilain
Darren Duncan wrote: I should emphasize that I never expected to be able to send any type of ASTs over the pipe to the database. They would still be interpreted by the database driver for Perl and/or a wrapper thereon, into the database native format. Its just that, to an application, it woul

Re: DBI v2 - The Plan and How You Can Help

2005-07-12 Thread Sam Vilain
Dean Arnold wrote: RE: LOBs and "SQL Parse Trees": having recently implemented LOB support for a JDBC driver (and soon for a DBD), I can assure you that SQL parse trees are unneeded to support them. For databases Great! Perhaps you can shed some light on how to do it for this, then. SQL comma

Re: Raw bytes in perl6

2005-07-12 Thread Sam Vilain
Yuval Kogman wrote: By the way, a nice use case for using the rules engine could be "parsing" a stream of SAX events into a structure... XML::Simple in perl6 could be really as simple as it sounds =) Can anyone see this being retrofitted on top of current rules semantics? How does PGE relate to t

Re: DBI v2 - The Plan and How You Can Help

2005-07-13 Thread Sam Vilain
Dean Arnold wrote: Column 3 is a BYTEA column in Pg and needs special peppering to work. What sort of "peppering" ? DBI provides SQL_BLOB, and SQL_CLOB type descriptors (as well as SQL_BLOB_LOCATOR and SQL_CLOB_LOCATOR), so presumably DBD::Pg (or any other DBD supporting LOBs) provides the logic

Re: MML dispatch

2005-07-13 Thread Sam Vilain
Larry Wall wrote: In addition to what chromatic said, I'd like to point out that you've got the abstraction levels backwards by my lights: these days I tend to think of the class as a restricted form of role. A class is restricted to having to provide a working interface to real objects. Can I

Database Transactions and STM [was: Re: STM semantics, the Transactional role]

2005-07-17 Thread Sam Vilain
Yuval Kogman wrote: everyone gets to choose, and another thing I have in mind is the Transactional role... DBI::Handle does Transactional; To the STM rollbacker and type checker thingy this means that any IO performed by DBI::Handle invoked code is OK - it can be reversed using the Transa

Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-17 Thread Sam Vilain
Say I make an "accessor" method for an attribute that doesn't really 'exist'. For instance, a good example of this is the "month_0" vs "month" properties on a date object; I want to make both look equivalent as real properties, but without the users of the class knowing which one is the "real" on

Re: Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-18 Thread Sam Vilain
Larry Wall wrote: > > Users of the class includes people subclassing the class, so to them > > they need to be able to use $.month_0 and $.month, even though there > > is no "has $.month_0" declared in the Class implementation, only > > "has $.month". We thought about defining the attribute varia

Re: Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-20 Thread Sam Vilain
Piers Cawley wrote: > > Users of the class includes people subclassing the class, so to them > > they need to be able to use $.month_0 and $.month, even though there > > is no "has $.month_0" declared in the Class implementation, only > > "has $.month". We thought about defining the attribute va

Re: Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-21 Thread Sam Vilain
Larry Wall wrote: : Do the following exist then: :has @x; # private, lexically scoped [...] :has %y; # private, lexically scoped [...] Yes, the sigil is fairly orthogonal to all this, hopefully. Yes, for isn't the sigil just a compact form of saying "does Hash" or "does Array" ?

Re: Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-23 Thread Sam Vilain
Stevan Little wrote: Yes, we have. One thing to consider is that it is much easier to get the "Role order doesn't matter" thing when they are composed. Once you start keeping the roles around, you run into the possiblity for such things as "next METHOD" being executed in Role context. I wont ev

Re: Database Transactions and STM [was: Re: STM semantics, the Transactional role]

2005-07-23 Thread Sam Vilain
Yuval Kogman wrote: everyone gets to choose, and another thing I have in mind is the Transactional role... DBI::Handle does Transactional; To the STM rollbacker and type checker thingy this means that any IO performed by DBI::Handle invoked code is OK - it can be reversed using the Transa

Re: Subroutine and Method Introspection

2005-07-24 Thread Sam Vilain
chromatic wrote: A12 and S12 describe introspection on objects and classes. The metaclass instance has the method getmethods() which returns "method descriptors". The design specifies several traits queryable through these descriptors. [...] Currently, there's no way to query these traits

Re: Exposing the Garbage Collector

2005-07-24 Thread Sam Vilain
Piers Cawley wrote: Let's say I have a class, call it Foo which has a bunch of attributes, and I've created a few of them. Then, at runtime I do: eval 'class Foo { has $.a_new_attribute is :default<10> }'; Assuming I've got the syntax right for defaulting an attribute, and lets assume I have,

Re: Do I need "has $.foo;" for accessor-only virtual attributes?

2005-07-24 Thread Sam Vilain
Stevan Little wrote: This is extended into the other sigil types; has %.foo; is sugar for this: has Hash $foo; # or has %foo, but really, the point is it's # an implementation detail, right? method foo is rw { return Proxy.new( :FETCH{ $foo }, # or a facade

RE: $object.meta.isa(?) redux

2005-08-10 Thread Sam Vilain
On Wed, 2005-08-10 at 21:00 -0400, Joe Gottman wrote: >Will there be an operator for symmetric difference? I nominate (^). That makes sense, although bear in mind that the existing Set module for Perl 6, and the Set::Scalar and Set::Object modules for Perl 5 use % for this (largely due to ove

Re: Time::Local

2005-08-15 Thread Sam Vilain
On Mon, 2005-08-15 at 16:33 -0700, Larry Wall wrote: > : I would assume that you would choose time 0.0 = Jan 1, 2000 at 00:00:00.0 > : TAI (December 31, 1999 at 23:59:29.0 UTC), making the whole thing free of > : any UTC interferences. But there is an argument for making the zero point a > : reco

Re: Time::Local

2005-08-16 Thread Sam Vilain
On Mon, 2005-08-15 at 22:24 -0700, Larry Wall wrote: > : > That's my leaning--if I thought it might encourage the abandonment of > : > civil leap seconds, I'd be glad to nail it to Jan 1, 2000, 00:00:00.0 UTC. > : If we're going with TAI, can't we just nail it to the epoch it defines, > : instead?

Re: Time::Local

2005-08-17 Thread Sam Vilain
On Wed, 2005-08-17 at 01:28 -0500, Dave Rolsky wrote: > > Why on earth would you want to encourage such a short sighted > > programming practise? The earth wobbles like a spinning top. In fact > It's hardly short sighted to want leap seconds to be abandoned (not in > Perl but world wide). The f

Complex types

2005-10-12 Thread Sam Vilain
Hi all, Is it intentional that S09 lists unboxed complex types, but equivalent Boxed types are missing from the "Types" section in S06? Sam.

Re: new sigil

2005-10-20 Thread Sam Vilain
On Thu, 2005-10-20 at 08:45 -0700, Larry Wall wrote: > More info. ¢T is a scalar variable just like $T, but enforces a > class view, so you can use it as a class parameter, and pass any > object to it, but only access the classish aspects of the object. > The only other big difference is that you

Re: Why submethods

2005-10-30 Thread Sam Vilain
On Sat, 2005-10-29 at 17:30 -0400, Stevan Little wrote: > However, it could also be that the creator of Foo did not intend for > subclasses to be able to "Just Work", and that the whole idea of Foo > is to do a "Template Method" style pattern in which subclasses must > implement the &help_pro

Re: $_ defaulting for mutating ops

2005-11-02 Thread Sam Vilain
On Wed, 2005-11-02 at 11:46 -0700, John Williams wrote: > It is not so much an operator, as it is a subroutine with really strange > syntax, and the side-effect of changing the $_ variable. You need to use > an operator to get it to affect a different variable. operators _are_ subroutines. There

Re: $_ defaulting for mutating ops

2005-11-02 Thread Sam Vilain
On Wed, 2005-11-02 at 09:03 -0500, Rob Kinyon wrote: > I think the difference comes from the Principle of Least Surprise. The > various operators being discussed in this thread are all operators > which are in languages that have common use - C, C++, Java, the .Net > stack, etc. Regexen and the var

Re: scalar/array contexts in perl5 vs. perl6

2005-12-04 Thread Sam Vilain
On Sun, 2005-12-04 at 13:10 -0500, Mike Li wrote: > what is a good translation of the following C into perl6? > [...] >int x = 0; int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; y[x++]++; /* line > that matters */ [...] > > > in perl5, i would've written something like: > > my $x = 0; my @y = 1..9

Re: Some thoughts on threading

2005-12-11 Thread Sam Vilain
On Thu, 2005-12-08 at 17:16 +0100, Ron Blaschke wrote: > The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software." > [1] He starts with "The biggest sea change in software development since > the OO revolution is knocking at the door, and its name is Concurrency." Perhaps have a

Re: handling undef - second draft

2005-12-18 Thread Sam Vilain
On Sat, 2005-12-17 at 17:27 -0800, Darren Duncan wrote: > 3. A flag that says we know that some operation failed, such as would > be exploited in the " err " > situations. > This concept is like an exception which isn't thrown but returned. "Dropping" an exception, perhaps? :) > 1. I accept th

Re: Obsoleting "require 'Some/Module.pm'"

2005-12-19 Thread Sam Vilain
On Mon, 2005-12-19 at 14:58 +0200, Gaal Yahas wrote: > Can we make this work? > > my $mod = "Some::Module"; > require $mod; What about casting it to a package; require ::{$mod}; (not sure if the syntax is quite right) Sam.

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Damian Conway wrote: >I'm not enamoured of the .# I must confess. Nor of the #. either. I wonder >whether we need the dot at all. Or, indeed, the full power of arbitrary >delimiters after the octothorpe. > > Agreed. >What if we restricted the delimiters to the five types of balanced brackets

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Larry Wall wrote: >On Tue, Apr 11, 2006 at 12:26:13PM +1200, Sam Vilain wrote: >: This does mean that if you comment out blocks with s/^/#/, you mess up on: >: >: #sub foo >: #{ >: # if foo { } >: #} > >Well, actually, that still works. > > Oh, true :-) B

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Larry Wall wrote: >: But this fragment dies: >: >: #sub foo >: #{ >: # bar { } unless baz >: #} >I don't see how that's different at all from the first example. > > “#sub foo” is parsed as a comment token “#{ # bar { }” is the next comment token then we get “unless baz” Unless you are b

Re: using the newer collection types

2006-05-04 Thread Sam Vilain
Darren Duncan wrote: >Speaking a little more technically, a Relation has 2 main components, >its heading and its body. The heading is a set of 0..N keys (called >"attributes" in relation-land), and the body is a set of 0..N >Mappings (called "tuples" in relation-land), where they set of keys

Re: using the newer collection types

2006-05-05 Thread Sam Vilain
Darren Duncan wrote: >>>Is there a reference for the meaning of these methods? >>> >>> >>There are many written references to these methods; just type >>"relational algebra" into Google. >> >> > >I will add that the first hit on such a search, the Wikipedia page on >relational algebra

Re: using the newer collection types

2006-05-07 Thread Sam Vilain
Darren Duncan wrote: >>Also, I don't agree with the notion of a "header" of each relation. It >>has a type for each tuple item, sure, but "header" just sounds like the >>sort of thing you want in a ResultSet, not a Relation. >>Sam. >> >> >A relation's heading is essentially the definition of t

Re: ACID transactions for in-memory data structures

2006-05-17 Thread Sam Vilain
Rob Kinyon wrote: >On 5/15/06, Audrey Tang <[EMAIL PROTECTED]> wrote: > > >>Rob Kinyon wrote: >> >> >>>I'm pretty sure it wouldn't be very feasible to do this natively in >>>P5. But, would it be possible to do it natively in P6? As in, >>>supported within the interpreter vs. through some sor

Re: packages vs. classes

2006-05-22 Thread Sam Vilain
Larry Wall wrote: >'Course, I left out everything about prototype objects there... > >The name Foo also (in context) represents an uninitialized object of >the class in question. Any object, initialized or not, can get at >its type handlers by saying > >Foo.meta >$foo.meta > >and, in fact

Re: hyp-op examples of a Bag type in S03

2006-05-22 Thread Sam Vilain
Darren Duncan wrote: > $bag1 >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7) > $bag2 >>-<< (1,1,1,1); # probably the same > $bag3 >>-<< (1,1,2,1); # ? > > Bag's won't .does(Array) or .does(Coll[Seq,...]), so that hyperoperator won't work - if anything it would try to add the (1,1,1,1) li

Re: [svn:perl6-synopsis] r9307 - doc/trunk/design/syn

2006-05-25 Thread Sam Vilain
[EMAIL PROTECTED] wrote: >+In either case this sets the C property of the container to C. >+Subroutines have a variant of the C property, C, that >+sets the C property instead. The C property specifies >+a constraint to be checked upon calling C that, unlike the C >+property, is not advertized as

Re: Concurrency: hypothetical variables and atomic blocks

2006-05-31 Thread Sam Vilain
Jonathan Lang wrote: >How does an atomic block differ from one in which all variables are >implicitly hypotheticalized? I'm thinking that a "retry" exit >statement may be redundant; instead, why not just go with the existing >mechanisms for successful vs. failed block termination, with the minor

Re: Concurrency: hypothetical variables and atomic blocks

2006-05-31 Thread Sam Vilain
Daniel Hulme wrote: >>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. > The lock o

Re: Perl5 -> Perl 6 Translations Design Document

2006-06-05 Thread Sam Vilain
Sage La Torra wrote: >Hello all, > >I'm the student picking up on the translation work lwall started. Since the >perl 5 parser is more or less complete, I've headed straight to the >translation work. I'm going to be taking on the translations a few at a >time, starting with the easiest translation

Re: easier duck typing in .can

2006-06-17 Thread Sam Vilain
Yuval Kogman wrote: Since CANDO is a multimethod, IMHO this can be safely extended to allow: $object.can(Class); $object.can(Role); to better support duck typing. Why would you not use .does or .isa there? Are you wanting this to go through all of the Class/Role's methods

Re: lvalue functions and lvalue parameters

2006-06-20 Thread Sam Vilain
Jonathan Scott Duff wrote: >> 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: >> > That looks like it should be a compile-time failure to me. > De

Re: features of and declaring Mapping|Set|Hash values|variables

2006-06-29 Thread Sam Vilain
Darren Duncan wrote: > 1. Looking at the language in Synopsis 6 for data types, I see: > > Set Unordered Seqs that allow no duplicates > JunctionSets with additional behaviours > PairSeq of two elements that serves as an one-element Mapping > Mapping Pair

Re: binding operators and related introspection

2006-07-17 Thread Sam Vilain
Darren Duncan wrote: > But I would also like to have an easy way to change all bindings to > the same variable at once to point to the same new variable. > [...] >my $x = 'foo'; >my $y = 'bar'; >my $z := $x;# $x and $z point to same 'foo', $y to a 'bar' >$z.rebind_all_aliases_

Re: META vs meta

2006-09-12 Thread Sam Vilain
Larry Wall wrote: > : There is currently a mismatch between S12 and Pugs. The former specifies > $obj.META, the latter has implemented $obj.meta. > > .META is more correct at the moment. > Does making it all upper caps really help? It's still a pollution of the method space, any way that you

Re: Capture sigil

2006-09-21 Thread Sam Vilain
Larry Wall wrote: > Okay, I think this is worth bringing up to the top level. > > Fact: Captures seem to be turning into a first-class data structure > that can represent: > > argument lists > match results > XML nodes > anything that requires all of $, @, and % bits. > Also;

Nitpick my Perl6 - parametric roles

2006-09-25 Thread Sam Vilain
Anyone care to pick holes in this little expression of some Perl 6 core types as collections? I mean, other than missing methods ;) role Collection[\$types] { has Seq[$types] @.members; } role Set[::T = Item] does Collection[T] where { all(.members) =:= one(.members); };

Re: Nitpick my Perl6 - parametric roles

2006-09-25 Thread Sam Vilain
TSa wrote: >> role Collection[\$types] { >>has Seq[$types] @.members; >> } > This is a little wrapper that ensures that collections have got > a @.members sequence of arbitrary type. This immediately raises > the question how Seq is defined. > [...and later...] > Are you sure that the u

Re: Mutability vs Laziness

2006-09-25 Thread Sam Vilain
Aaron Sherman wrote: > Carried over form IRC to placeholder the conversation as I saw it: > > We define the following in S06 as immutable types: > > ListLazy Perl list (composed of Seq and Range parts) > Seq Completely evaluated (hence immutable) sequence > Range

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Miroslav Silovic wrote: > TSa wrote: > >>> role Set[::T = Item] does Collection[T] where { >>> all(.members) =:= one(.members); >>> }; >>> >> Nice usage of junctions! >> >> > > But buggy - one means *exactly* one. So for an array of more than 1 > element, all(@array) never

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Darren Duncan wrote: > Unless I'm mistaken, you may be going about this the wrong way. > > Within a system that already has an underlying > set-like type, the Junction in this case, a test > for uniqueness is (pardon any spelling): > >all(@items).elements.size === @items.size > > The all() wi

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
TSa wrote: > HaloO, > > Sam Vilain wrote: > >> perl -MPerl6::Junction=one,all -le '@foo=qw(1 2 3 4); print "yes" if >> (all(@foo) eq one(@foo))' >> yes >> > > But does it fail for duplicates? I guess not because junctions

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Darren Duncan wrote: >> Perhaps, but then Junctions might not assume elements have equality or >> identity operations defined. >> > As I recall, every type in Perl 6 has an equality and identity > operation defined because the Object superclass provides one. If > nothing else, the type's eq

Re: class interface of roles

2006-10-01 Thread Sam Vilain
TSa wrote: > HaloO, > > is this subject not of interest? I just wanted to start a > discussion about the class composition process and how a > role designer can require the class to provide an equal > method and then augment it to achieve the correct behavior. > Contrast that with the need to do th

Re: Junctions - feedback and desires

2005-03-10 Thread Sam Vilain
Rod Adams wrote: I do not believe that is possible. This is the "filtering" or "unification" behavior that people keep wanting junctions to have, which they do not. Aww! But what about all the great problems that could be expressed with them? I know of two languages that consider this to be a co

SEND + MORE = MONEY (works now in pugs with junctions!)

2005-03-10 Thread Sam Vilain
Rod Adams wrote: And as one who recently proposed a way of getting Prolog like features in Perl (through Rules, not Junctions), I understand the appeal completely. Junctions are not the way to that goal. They are something different. > Taking multiple values at once is what junctions are all abo

Re: [Fwd: Re: [RFC] A more extensible/flexible POD (ROUGH-DRAFT)]

2005-03-17 Thread Sam Vilain
Aaron Sherman wrote: Sam "mugwump" Vilain refers to each of these syntaxes as /Pod dialects/. He is working on more formally defining the common model or "AST" that these dialects map to. Why? Seriously, why on earth do you want to encourage the proliferation of variant markup languages?! There are

Re: [Fwd: Re: [RFC] A more extensible/flexible POD (ROUGH-DRAFT)]

2005-03-17 Thread Sam Vilain
Damian Conway wrote: [No, I'm not back; I'm just passing by. But I feel that I need to comment on this whole issue] Thanks! This message has lots of useful information that I would have otherwise probably missed. It seems that the basic premise of the POD document object model gels well with t

Re: identity tests and comparing two references

2005-03-31 Thread Sam Vilain
Darren Duncan wrote: Now I seem to remember reading somewhere that '===' will do what I want, but I'm now having trouble finding any mention of it. So, what is the operator for reference comparison? As someone who wrote a tool that uses refaddr() and 0+ in Perl 5 to achieve the same thing, I agre

Re: Documentary annotations: $what doc

2005-04-01 Thread Sam Vilain
Luke Palmer wrote: Supposing I had a "doc" trait, could I say: sub f2c (Num $temp doc) doc {...} Or would I be forced to spell it doc('stuff') ? Well, first you need an `is` somewhere in there. And after that I think you'll need to do it in doc('stuff') form. If we did allow doc<>,

Re: :=: (OT)

2005-04-04 Thread Sam Vilain
Juerd wrote: For some reason, I keep typing :=: instead of =:=. Do other people experience similar typo-habits with new operators? One of my other Perl 6 typo-habits is <<^H^Hargh!^H^H^H^H^H«, but that's because I like how « and » look, but can't yet easily type them. Juerd «»«»«»«»«»«»«»«»«»«»«»«»

Re: Whither "use English"?

2005-04-13 Thread Sam Vilain
Juerd wrote: According to Wikipedia there are around 400 million native English speakers and 600 million people who have English as a second language. Should the remaining ~5.5 billion humans be exluded from writing perl code just so that we English speakers can understand all the code that is w

Macros [was: Whither "use English"?]

2005-04-14 Thread Sam Vilain
Larry Wall wrote: (B> Well, only if you stick to a standard dialect. As soon as you start (B> defining your own macros, it gets a little trickier. (B (BInteresting, I hadn't considered that. (B (BHaving a quick browse through some of the discussions about macros, many (Bof the macros I saw[

Re: Sun Fortress and Perl 6

2005-04-27 Thread Sam Vilain
Luke Palmer wrote: `is pure` would be great to have! For possible auto-memoization of likely-to-be-slow subs it can be useful, but it also makes great documentation. It's going in there whether Larry likes it or not[1]. There are so incredibly many optimizations that you can do on pure functions,

Re: Threading in Parrot vs Perl

2005-04-28 Thread Sam Vilain
Rod Adams wrote: I would be dismayed if autothreading used threads to accomplish it's goals. Simple iteration in a single interpreter should be more than sufficient. For sure. No point in doing 10_000 cycles to set up a scratch area for a single boolean test that might take 10 cycles. A software

Re: S29: punt [pwned!]

2005-05-12 Thread Sam Vilain
Rod Adams wrote: It looks like I'm going to have to punt on finishing S29. On behalf of pugs committers, we will gladly adopt this task, which is in the pugs repository already at docs/S29draft.pod, as well as having a set of foundation classes that correspond to all these object methods in docs/sr

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Rob Kinyon wrote: If that's the case, then if I change a variable that isa Str (that isa Num), does it change what it inherits from? Please don't use "inherits" when talking about these core types. Classical inheritance just doesn't work with the varied sets of numbers. All those stories you were

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Larry Wall wrote: : pugs> '1.28' * '2.56' : 3.2768 : What is (or should be) going on here here? : [1] role NumRole { : method infix:<*> returns Num (NumRole $x, NumRole $y: ) { ... } : } : Str.does(NumRole); : [3] multi sub prefix:<+> (Str $x) returns Num { ... } : multi s

Re: Default precedence level of user defined infix ops

2005-05-18 Thread Sam Vilain
Luke Palmer wrote: And how do I explicitly define the precedence? Using the `tighter`, `looser`, and `equiv` traits. You specify precedence in terms of the precedence of other existing ops. sub infix:<.>(&f, &g) is looser(&infix:<+>) {...} This is interesting. So, infix:< > is similar to Hask

Re: reduce metaoperator on an empty list

2005-05-19 Thread Sam Vilain
Edward Cherlin wrote: Here is the last answer from Ken Iverson, who invented reduce in the 1950s, and died recently. file:///usr/share/j504/system/extras/help/dictionary/intro28.htm [snip] Thanks for bringing in a little history to the discussion. Those links are all local to your system; do yo

Re: reduce metaoperator on an empty list

2005-05-19 Thread Sam Vilain
Stuart Cook wrote: In Haskell, there is a distinction between foldl and foldl1 (similar remarks apply to foldr/foldr1[1]): The former (foldl) requires you to give an explicit 'left unit'[2], which is implicitly added to the left of the list being reduced. This means that folding an empty list will

Re: Complex Arithmetic

2005-05-19 Thread Sam Vilain
Edward Cherlin wrote: There was a discussion of the principal value of square root on this list some time back, making the point that for positive [...] It turns out that the domain and range and the location of the cut lines have to be worked out separately for different functions. Mathemat

Re: [S29] uniq

2005-05-19 Thread Sam Vilain
Mark Overmeer wrote: 'uniq' differs from 'sort' because there is no order relationship between the elements. A quick algorithm for finding the unique elements in perl5 is sub uniq(@) { my %h = map { ($_ => 1) } @elements; keys %h; } ...and an even quicker one is: use Set::Object;

Junctive and Higher order Types

2005-05-19 Thread Sam Vilain
Hi all, While trying to convert Haskell statements like this to Perl 6: data Cxt = CxtVoid -- ^ Context that isn't expecting any values | CxtItem !Type -- ^ Context expecting a value of the specified type | CxtSlurpy !Type -- ^ Context expecting multiple values of the

Re: Sets

2005-05-26 Thread Sam Vilain
Patrick R. Michaud wrote: > The continuing exchanges regarding junctions, and the ongoing tendency > by newcomers to think of them and try to use them as sets, makes > me feel that it might be worthwhile to define and publish a standard > C class and operations sooner rather than later in Perl 6

Re: function signatures?

2005-05-29 Thread Sam Vilain
Ingo Blechschmidt wrote: Are signatures going to be an exposed first class object in Perl 6? I hope so, too. ~&foo.signature; # Signature objects should stringify to a canonized form, e.g.: # ~sub (Str $bar, CoolClass $z where {...}) {...}.signature ==> # 'Str $bar, ANONCLASS(0xDEADBEEF)

Re: Strongly typed containers?

2005-05-30 Thread Sam Vilain
Yuval Kogman wrote: > We already have the Set class, how do we say what it contains? > class Set { >has $.type; >method members returns $.type () { ... } > } > my Set of Int $s = Set.new; # is this how you call it? You are describing "Higher Order" types, also called Generic Algebraic Dat

Re: Unicode Operators cheatsheet, please!

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: I would love to see a document (one per editor) that describes the Unicode characters in use and how to make them. The Set implementation in Pugs uses (at last count) 20 different Unicode characters as operators. I have updated the unicode quickref, and started a Perlmonks dis

Re: date and time formatting

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: What I'm trying to get at isn't that DateTime's API should be preserved. I'm saying that the concept of DateTime should be ported. Core or not core - it doesn't matter. When use'd (or installed), it should override now() (and anyone else we can think of) to return an object that

Re: "returns" and context

2005-05-31 Thread Sam Vilain
Rod Adams wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } I suspect a typed junction would look like : "Junction of Int|Str". Not quite. AIUI that means a Junct

Re: What the heck is... wrong with Parrot development?

2005-06-06 Thread Sam Vilain
Fagyal Csongor wrote: With all respect, I think this is a very important thing which needs attention, and I hope that you will help us to clarify the situation. I am pretty sure Dan did not leave because he had a bad day - we know he Dan's position was very stressful, he had people from all s

Re: reduce metaoperator on an empty list

2005-06-06 Thread Sam Vilain
Roger Hale wrote: This is why I would rather the o -> [o] circumfixion left [o] an infix, not prefix operator. I would rather be explicit about my identity: $product = 1 [*] @array; Hmm. Not all operators *have* an identity. You'd have to write, in that case; @array[0] [ƒ] @[EMAI

Re: reduce metaoperator on an empty list

2005-06-06 Thread Sam Vilain
Damian Conway wrote: What you want is: $product = ([*] @values err 0); Or: $factorial = ([*] 1..$n err 1); The "err" operator bind only to the point on the instruction it is attached to, ie it's not a shortcut for eval(), right? I'm just seeing some edge cases here for custom defined o

Re: reduce metaoperator on an empty list

2005-06-07 Thread Sam Vilain
Luke Palmer wrote: < and > still don't make sense as reduce operators. Observe the table: # of args | Return (type) 0 | -Inf 1 | Num (the argument) 2 | bool ... | bool Let's look at the type of one of the many `reduce' vari

Re: reduce metaoperator on an empty list

2005-06-09 Thread Sam Vilain
TSa (Thomas Sandlaß) wrote: I'm not sure but Perl6 could do better or at least trickier ;) Let's assume that < > <= >= when chained return an accumulated boolean and the least or greatest value where the condition was true. E.g. 0 < 2 < 3 returns 0 but true 1 < 2 < 1 returns 1 but false

AUTLOAD and $_

2005-06-19 Thread Sam Vilain
From S10; In any case, there is no longer any magical $AUTOLOAD variable. The name being declared or defined can be found in $_ instead. The name does not include the package name. You can always get your own package name with $?PACKAGENAME. So, what is the prototype of AUTOLOAD? It is

Re: AUTLOAD and $_

2005-06-20 Thread Sam Vilain
Juerd wrote: I think there exists an even simpler way to avoid any mess involved. Instead of letting AUTOLOAD receive and pass on arguments, and instead of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its thing, and then have *perl* call the sub? sub AUTOLOAD ($w) { return o

Re: AUTLOAD and $_

2005-06-20 Thread Sam Vilain
chromatic wrote: Who says AUTOLOAD will always either call a loaded sub or fail? Maybe it should be passed a continuation too, then? Then it could choose exactly what to do with it. Sam.

AUTOLOAD, this time distinct from AUTOSUB etc (and spelt correctly)

2005-06-20 Thread Sam Vilain
OK, that last discussion was productive, but I think we all (including myself) overlooked the fact that the AUTOLOAD and AUTOSUB methods are implied to have different calling conventions; There is still an AUTOLOAD hook that behaves as in Perl 5. The (AUTO*) routines are expected to return a

Re: AUTOLOAD, this time distinct from AUTOSUB etc (and spelt correctly)

2005-06-20 Thread Sam Vilain
Rod Adams wrote: I never liked the idea of out-of-band arguments. Either something is passed, is available due to being in a broader scope, or can be gleamed from introspection. ok. First of all, I agree with the basic sentiment. However, to play devil's advocate and re-interpret what you ju

Magic mutators and my $var is Proxy( ... );

2005-06-26 Thread Sam Vilain
To me it is a trivial case that you want to provide a fake attribute which for all intents and purposes behaves exactly like there was a real attribute there, backing against another attribute. A Date object is a classic example of this; you want to provide 0-based and 1-based attributes, which y

Re: Magic mutators and my $var is Proxy( ... );

2005-06-26 Thread Sam Vilain
Sam Vilain wrote: To me it is a trivial case that you want to provide a fake attribute which for all intents and purposes behaves exactly like there was a real attribute there, backing against another attribute. A Date object is a classic example of this; you want to provide 0-based and 1-based

Re: AUTLOAD and $_

2005-06-26 Thread Sam Vilain
Piers Cawley wrote: For myself, I'd like to see AUTOLOAD with a signature along the lines of: sub AUTOLOAD (Symbol $sym, ArgumentCollection $args, Continuation $cc) returns (Code | Pair) { ... } This presupposes a deal of support infrastructure, but also provides flexibility. F

  1   2   >