CATCH: changing the topic and preserving the call stack

2006-09-07 Thread Mark Stosberg
with it. Is it valid to not use a when/default chain in CATCH or to change topic, using: $_ = $my_new_topic. ? An example of that would be helpful. My second point involves re-throwing errors with useful stack traces. Here's an example similar to what we do in CGI::App: try { boom(); } if ($!) { die died

block owner, topic and the referential environment

2005-07-27 Thread TSa (Thomas Sandlaß)
topic that flows into blocks from further outside if not explicitly bound with - like: $topic := Some.new; $_ := $topic; for @objects { .action } # call on $/ from @objects with $_ := $topic # in all loops @objects».action; # same for single action syntax

invocant vs. topic (was: Re: -X's auto-(un)quoting?)

2005-04-26 Thread Thomas Sandlaß
Luke Palmer wrote: My brother asked me to take out the trash. I asked him to do it. I believe that the subject there is my brother in the first sentence and I in the second. The topic is either to take out the trash or just the trash throughout (English speakers wouldn't have any trouble

Re: invocant vs. topic (was: Re: -X's auto-(un)quoting?)

2005-04-26 Thread Mark Reed
I¹m only an amateur linguist, but from a linguistic point of view, there are several related terms in this space. The term ³subject² has many meanings in English, including ³topic². But from a grammatical and linguistic standpoint, there are only two meanings of ³subject², and ³topic

Reminder: The EU constitution's off-topic

2004-01-05 Thread Dan Sugalski
And should stay off-list, thanks. -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even

Re: Perl6 Daydreams (on topic but frivolous)

2003-07-04 Thread Jonadab the Unsightly One
Iain Truskett [EMAIL PROTECTED] writes: * Jonadab the Unsightly One ([EMAIL PROTECTED]) [01 Jul 2003 23:41]: Iain Truskett [EMAIL PROTECTED] writes: Not the only one. And with Parrot being able to execute Z-code, it might be sane to port Inform to Parrot! Did you mean port Inform

Re: Perl6 Daydreams (on topic but frivolous)

2003-07-02 Thread Nicholas Clark
On Wed, Jul 02, 2003 at 08:55:37AM +1000, Iain Truskett wrote: * Jonadab the Unsightly One ([EMAIL PROTECTED]) [01 Jul 2003 23:41]: Iain Truskett [EMAIL PROTECTED] writes: Not the only one. And with Parrot being able to execute Z-code, it might be sane to port Inform to Parrot! Did

Re: Perl6 Daydreams (on topic but frivolous)

2003-07-01 Thread Jonadab the Unsightly One
Iain Truskett [EMAIL PROTECTED] writes: Not the only one. And with Parrot being able to execute Z-code, it might be sane to port Inform to Parrot! Did you mean port Inform to run on Parrot, or port Inform to compile to parrot? If the former, that should be no problem. If the latter, I'm not

Re: Perl6 Daydreams (on topic but frivolous)

2003-07-01 Thread Iain Truskett
* Jonadab the Unsightly One ([EMAIL PROTECTED]) [01 Jul 2003 23:41]: Iain Truskett [EMAIL PROTECTED] writes: Not the only one. And with Parrot being able to execute Z-code, it might be sane to port Inform to Parrot! Did you mean port Inform to run on Parrot, or port Inform to compile to

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-29 Thread Simon Cozens
[EMAIL PROTECTED] (Jonathan Scott Duff) writes: My only dream is that by this time next year we have a fully- functional-people-can-use-it-in-production Perl6. It doesn't even have to be 100% complete; I think just 85% would be enough if it were the right 85%. I've been using an 85%-complete

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-29 Thread Gyan Kapur
Simon Cozens writes: I've been using an 85%-complete Perl 6 in production for the past five years. It's called Perl 5. ;) Unfortunately, although Perl 5 may be 85% of Perl 6, it is the 85% that has been sliced up so many times that it's now looking like a sloppy Joe. The trick with perl 6 is

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-29 Thread Miko O Sullivan
On Sun, 29 Jun 2003 05:17:44 -0400, Gyan Kapur wrote reconstituted cheeseburger /me wonders if pitching Perl6 as a reconstituted cheeseburger is going to sell it to the world. :-) -Miko Miko O'Sullivan Programmer Analyst Rescue Mission of Roanoke

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-29 Thread Jonadab the Unsightly One
Miko O Sullivan [EMAIL PROTECTED] writes: - I'm looking forward to more Pure Perl modules. I frankly admit that I don't like coding in C. Every time I download a module that has compiled C code I feel like I'm stuck in some place where I want to play baseball and everybody else wants to

Perl6 Daydreams (on topic but frivolous)

2003-06-28 Thread Miko O Sullivan
Ah, summertime (at least here in the northern hemisphere). The language list has slowed down to a trickle, hopefully because everybody is relaxing in a cool place, idly sipping non-alcoholic spritzers next to some special person, reading low-brow literature (or, as in my case, Apoc 6). This

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-28 Thread Jonathan Scott Duff
On Fri, Jun 27, 2003 at 10:50:40PM -0400, Miko O Sullivan wrote: It would be interesting to hear your Perl6 daydreams. My only dream is that by this time next year we have a fully- functional-people-can-use-it-in-production Perl6. It doesn't even have to be 100% complete; I think just 85% would

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-28 Thread Rafael Garcia-Suarez
Jonathan Scott Duff wrote in perl.perl6.language : My only dream is that by this time next year we have a fully- functional-people-can-use-it-in-production Perl6. It doesn't even have to be 100% complete; I think just 85% would be enough if it were the right 85%. 20% would be enough if

Re: Perl6 Daydreams (on topic but frivolous)

2003-06-28 Thread Piers Cawley
Rafael Garcia-Suarez [EMAIL PROTECTED] writes: Jonathan Scott Duff wrote in perl.perl6.language : My only dream is that by this time next year we have a fully- functional-people-can-use-it-in-production Perl6. It doesn't even have to be 100% complete; I think just 85% would be enough if it

Re: Unifying invocant and topic naming syntax

2002-11-21 Thread Me
'-' means the topic gets set and is private to the block (ignoring aliasing effects): $_ = 1; for @foo - $_ { $_ = 2 }; print; # 1 It seems to me that a logical conclusion would be that a blank arg list after a '-' would mean the topic remains private (and is set to undef). Perhaps having bare

Re: Unifying invocant and topic naming syntax

2002-11-21 Thread Larry Wall
On Thu, Nov 21, 2002 at 11:27:07AM -0600, Me wrote: : And documenting this by the '-' distinction : described above (ie - means private $_ set : by mumble, no - means $_ is just the outer : lexical) would look natural as well being : logical and strikingly simple. It would, however, force people

RE: Unifying invocant and topic naming syntax

2002-11-21 Thread Martin D Kealey
On Thu, 2002-11-21 at 20:11, Brent Dax wrote: Are you suggesting this? if($error) { use visible 'croak'; require Carp; import Carp: 'croak'; croak($error); } No - that would be pointless as well as error-prone. My idea

Re: Unifying invocant and topic naming syntax

2002-11-21 Thread Me
Are you suggesting this? if($error) { use visible 'croak'; require Carp; import Carp: 'croak'; croak($error); } No - that would be pointless as well as error-prone. My idea of visible is that it would make a lexically scoped thing accessible to an inner dynamic scope at

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Andy Wardley
Me wrote: Well, I could argue that c) already exists in the form of passing parameters in parens. This reminds me of the Law of Demeter. It specifies what your methods should and shouldn't be able to do if you want to build a bright, shiny system that never has bugs, maintains itself, turns

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Larry Wall
On Tue, Nov 19, 2002 at 03:09:40PM -0600, Allison Randal wrote: : Larry wrote: : I'm trying to remember why it was that we didn't always make the first : argument of any sub the topic by default. I think it had to do with : the assumption that a bare block should not work with a copy

RE: Unifying invocant and topic naming syntax

2002-11-20 Thread Martin D Kealey
) be more closely controlled... and of course the former can be used to implement the latter: use visible '$topic'; no visible '$_'; -Martin

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Austin Hastings
--- Larry Wall [EMAIL PROTECTED] wrote: ... This might work now, presuming sub foo (;$_ = $=) (or whatever) is really a binding, and not an assignment. (That's another reason why //= is *wrong*--it implies assignment.) Umm, that's what it was supposed to do. IOW: sub($param //=

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Luke Palmer
Date: Wed, 20 Nov 2002 12:11:52 -0800 (PST) From: Austin Hastings [EMAIL PROTECTED] --- Larry Wall [EMAIL PROTECTED] wrote: ... This might work now, presuming sub foo (;$_ = $=) (or whatever) is really a binding, and not an assignment. (That's another reason why //=

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Me
in to the block and executing it? sub mumble (block) { block() } Oddly, if we make the first argument the topic by default, the second block actually gets block as its topic. That's...strange. This would go away with the above scenario. -- ralph

Re: Unifying invocant and topic naming syntax

2002-11-20 Thread Larry Wall
(block) { : block() : } : : Oddly, if we make the first argument the : topic by default, the second block actually : gets block as its topic. That's...strange. : : This would go away with the above scenario. True, but I think Cmumble has to be able to wrap its own idea of $_ around

RE: Unifying invocant and topic naming syntax

2002-11-20 Thread Brent Dax
to dynamic scope should (in general) be # more closely controlled... and of course the former can be # used to implement the latter: # # use visible '$topic'; # # no visible '$_'; if($error) { require Carp; import Carp: 'croak'; croak

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
don't understand when one could do the 'is given($_)' and not do the ($_ = $_). Any time that the caller's topic isn't supposed to be explicitly passed as an argument, but is still used within the subroutine. [example] And, yes, I could make it an optional argument, but them I have

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Andy Wardley
Larry Wall wrote: So I was thinking it'd be better to use something different to represent the outer topic... How about this: $_ # current topic $__ # outer topic $___ # outer outer topic ...etc... I also wondered if $= might be a suitable alias to the current

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Tanton Gibbs
How about this: $_ # current topic $__ # outer topic $___ # outer outer topic Unfortunately, or maybe fortunately, that is impossible to read correctly without having to move the cursor and count how many underscores exist. It seems to me, that in English

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Dan Sugalski
At 6:56 AM -0500 11/19/02, Tanton Gibbs wrote: How about this: $_ # current topic $__ # outer topic $___ # outer outer topic Unfortunately, or maybe fortunately, that is impossible to read correctly without having to move the cursor and count how many underscores

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
$_ # current topic $__ # outer topic $___ # outer outer topic [not sufficiently visibly distinct] [too much anyway] Agreed. Returning to the topic of binding/copying from a caller to a callee, what about using square brackets to mark implicit args thus

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
To summarize, we're discussing 3 features: a) the ability to set the topic with a block (sub, method, etc) b) the ability to set a default value for a parameter c) the ability to break lexical scope 1) for $_ only 2) for any variable Each of these features already have syntax that allows

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
Larry wrote: I'm trying to remember why it was that we didn't always make the first argument of any sub the topic by default. I think it had to do with the assumption that a bare block should not work with a copy of $_ from the outside. I dug through the archives. We were considering

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Austin Hastings
So what's wrong with: sub foo($param is topic //= $= // 5)# Shorter form with $= sub foo($param is topic //= $CALLER::_ // 5) It doesn't really seem like we can make it much shorter. Yes, we could convert //= into a single character, but why? People will understand //=. The idea

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Austin Hastings
--- Allison Randal [EMAIL PROTECTED] wrote: Larry wrote: I'm trying to remember why it was that we didn't always make the first argument of any sub the topic by default. I think it had to do with the assumption that a bare block should not work with a copy of $_ from the outside

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
Austin wrote: For methods, will that be the invocant or the first other parameter? $string.toLanguage(french) Topic is $string, or french ? It is the invocant. Allison

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote: So what's wrong with: sub foo($param is topic //= $= // 5)# Shorter form with $= sub foo($param is topic //= $CALLER::_ // 5) It doesn't really seem like we can make it much shorter. Yes, we could convert

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Deborah Ariel Pickett
Ah . . . one message with two things I wanted to talk about. Good. Allison wrote: On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote: So what's wrong with: sub foo($param is topic //= $= // 5)# Shorter form with $= sub foo($param is topic //= $CALLER::_ // 5

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Austin Hastings
--- Allison Randal [EMAIL PROTECTED] wrote: On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote: So what's wrong with: sub foo($param is topic //= $= // 5)# Shorter form with $= sub foo($param is topic //= $CALLER::_ // 5) It doesn't really seem like we can make

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
Austin wrote: The idea of $= as CALLER::_ is good, though. Though C//= $= // is a nasty sequence. Final // only required for another default: //= $= // 5 # Default to $CALLER::_, or 5 Aye, it's just a worst case scenario. C//= $= and C= $= are still line-noisy. It's a trade-off

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Austin Hastings
--- Deborah Ariel Pickett [EMAIL PROTECTED] wrote: Ah . . . one message with two things I wanted to talk about. Good. Allison wrote: On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote: So what's wrong with: sub foo($param is topic //= $= // 5)# Shorter form

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
c) the ability to break lexical scope Well, I could argue that c) already exists in the form of passing parameters in parens. Of course, that doesn't feel like breaking anything. So instead I'll argue that the word break is perhaps prejudicially perjorative. I'd say, to steer away from being

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
inheriting a caller's topic isn't going to be that common a thing that it needs such a short name, is it? 15% of the perl 5 builtins do so. I have suggested that, in some extreme scenarios such as short scripts, perhaps as many as 50% of subs might do so. But then again I probably ate a lot

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Mark J. Reed
On 2002-11-19 at 16:44:49, Me wrote: Elements of this shared vocabulary might be called 'locals' or 'yours'. I like the 'yours' idea from the point of view of the callee: my $inherited = your $_; However, I also like the idea of having to mark shareable lexicals explicitly in the

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
Elements of this shared vocabulary might be called 'locals' or 'yours'. I like the 'yours' idea from the point of view of the callee: my $inherited = your $_; I like that syntax, but I'm uncomfortable with an underlying principle, which is that one can reach in to the caller's

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Allison Randal
Me wrote: c) the ability to break lexical scope Well, I could argue that c) already exists in the form of passing parameters in parens. Of course, that doesn't feel like breaking anything. Formal parameters are lexically scoped. Lexical scope: references to the established entity can

RE: Unifying invocant and topic naming syntax

2002-11-19 Thread Brent Dax
Me: # Elements of this shared vocabulary might be # called 'locals' or 'yours'. # # I like the 'yours' idea from the point of # view of the callee: # # my $inherited = your $_; # # I like that syntax, but I'm uncomfortable # with an underlying principle, which is that # one can

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
# I'm uncomfortable [that] # one can reach in to the caller's lexical # context from any place in a callee's body. We need that capability if we're going to have lexically-scoped exports: I think I was a bit careless in how I worded that. My problem is not that one reaches in to the

RE: Unifying invocant and topic naming syntax

2002-11-19 Thread Brent Dax
Me: # I am thinking one should have to predeclare # in a sub's preamble that such a trick will # be going on. # # Thus something like: # # sub foo [bar] { ... } # # is (part of what is) required to be allowed # to create a bar sub in the context of the # caller of foo. So how does Exporter

Re: Unifying invocant and topic naming syntax

2002-11-19 Thread Me
ignores all sorts of practical problems and is plainly huge overkill for the situation. (All of this would of course still be subject to the Yours property that by default restricts localization to the topic, and to non-existent lexicals, ones the called sub intends to /add/ to the caller's lexical

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Larry Wall
On Mon, Nov 18, 2002 at 08:05:47AM +1100, Damian Conway wrote: : I still think my original: : : sub bar(; $foo = $topic) is given($topic) {...} : : is the appropriate compromise. Won't fly. Referring to something lexical before it's declared is a no-no. I think we need some other way

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Damian Conway
Larry Wall wrote: On Mon, Nov 18, 2002 at 08:05:47AM +1100, Damian Conway wrote: : I still think my original: : : sub bar(; $foo = $topic) is given($topic) {...} : : is the appropriate compromise. Won't fly. Referring to something lexical before it's declared is a no-no. I would maintain

RE: Unifying invocant and topic naming syntax

2002-11-18 Thread Brent Dax
Damian Conway: # Larry Wall wrote: # On Mon, Nov 18, 2002 at 08:05:47AM +1100, Damian Conway wrote: # : I still think my original: # : # : sub bar(; $foo = $topic) is given($topic) {...} # : # : is the appropriate compromise. # # Won't fly. Referring to something lexical before it's

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Me
Larry: sub bar(; $foo = topicmumble) {...} Damian: topic [would be] Cundef. I assumed topicmumble implied an 'is given'. I don't see why it couldn't. Damian: Hm. Given that the topic is in some sense a property of the lexical scope of the subroutine body, this might

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Larry Wall
On Tue, Nov 19, 2002 at 07:45:25AM +1100, Damian Conway wrote: : What mumble might be is an interesting, er, topic. : : I would argue it ought to be just $_, which is, after all, : the One True Topic. And conveniently lexically predeclared in all scopes. : : I would also argue that it ought

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Damian Conway
Larry wrote: The long and the short of it was that my sub foo ($_ := $arg = $_) is how you might set $arg to be both the topic and the given. Wow. I'm surprised by how much I don't like that syntax! ;-) I mean, two entirely different meanings for $_ in the space of one parameter

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Me
my sub foo ($_ = $_) to just propagate the outer $_ inward. That only works when $_ can somehow be shoe-horned into the parameter list. Whereas: my sub foo is given($_) works for *any* parameter list. Other than the placeholder situation, I don't understand when one

Re: Unifying invocant and topic naming syntax

2002-11-18 Thread Damian Conway
ralph wrote: Other than the placeholder situation, I don't understand when one could do the 'is given($_)' and not do the ($_ = $_). Any time that the caller's topic isn't supposed to be explicitly passed as an argument, but is still used within the subroutine. For example, the Class

Re: Unifying invocant and topic naming syntax

2002-11-17 Thread Damian Conway
Adam D. Lopresto wrote: It seems like that would be useful and common enough to write as sub bar(;$foo is given) { ... } Where $foo would then take on the caller's topic unless it was explicitly passed an argument. While I can certainly see the utility of that, I believe it is too

Re: Unifying invocant and topic naming syntax

2002-11-17 Thread Adam D. Lopresto
with: sub bar(;$foo = $def_foo) is given($def_foo) { ... } It seems like that would be useful and common enough to write as sub bar(;$foo is given) { ... } Where $foo would then take on the caller's topic unless it was explicitly passed an argument. -- Adam Lopresto

Re: Unifying invocant and topic naming syntax

2002-11-16 Thread Damian Conway
Luke Palmer wrote: My favorite was from ages ago: sub bar(;$foo //= $_) {...} I think that today that would be written more like this: sub bar(;$foo) is given($def_foo) { $foo = $def_foo unless exists $foo; ... } Though we might get away with: sub bar(;$foo = $def_foo) is

Re: Unifying invocant and topic naming syntax

2002-11-16 Thread Damian Conway
Andrew Wilson wrote: It's the difference between this: print; and this: print $_; It is as far as I'm concerned exactly what topic is all about. Exactly. It let's you write subroutines that behave like builtins with respect to $_. I think it's generally intended to be used like so

Re: Unifying invocant and topic naming syntax

2002-11-16 Thread Damian Conway
Acadi asked: Just ( my ) terminology clean-up : in this example sub{ } is implicit topicalizer No. It isn't a topicalizer at all. ( it does not set $_ explicitly ) Or implicitly. and you are setting $_ for perl . Yes. that's why you can use when . Yes. is this valid ? (morning()

Re: Unifying invocant and topic naming syntax

2002-11-15 Thread fearcadi
Damian Conway writes: Micholas Clarke asked: If a subroutine explicitly needs access to its invocant's topic, what is so wrong with having an explicit read-write parameter in the argument list that the caller of the subroutine is expected to put $_ in? Absolutely nothing

Re: Unifying invocant and topic naming syntax

2002-11-14 Thread Damian Conway
Micholas Clarke asked: If a subroutine explicitly needs access to its invocant's topic, what is so wrong with having an explicit read-write parameter in the argument list that the caller of the subroutine is expected to put $_ in? Absolutely nothing. And perfectly legal. You can even call

Re: on Topic

2002-11-13 Thread fearcadi
Me writes: Sorta. To quote an excellent summary: Topic is $_. is $_ always lexical variable. Yes. Or I can have $MyPackage::_ ? You can copy or alias any value. so if I understand correctly , Every topicalizer defines a topicalizer scope

Re: Unifying invocant and topic naming syntax

2002-11-13 Thread Larry Wall
On Mon, Nov 11, 2002 at 11:48:06PM -0600, Me wrote: : Are placeholders only usable with anonymous : subs, or named subs too? Placeholders are not intended for use with named subs, since named subs have a way of naming their parameters in a more readable fashion. However, it may well fall out that

Re: on Topic

2002-11-13 Thread Larry Wall
On Wed, Nov 13, 2002 at 03:11:32PM +0200, [EMAIL PROTECTED] wrote: : so if I understand correctly , : : Every topicalizer defines a topicalizer scope in which there is : implicit declaration : : my $_ ; : : and then lexical $_ ( implicitely ) is bound to ( or assigned to ) : whatever it

Re: Unifying invocant and topic naming syntax

2002-11-13 Thread Nicholas Clark
explicitly needs access to its invocant's topic, what is so wrong with having an explicit read-write parameter in the argument list that the caller of the subroutine is expected to put $_ in? It makes it clear. If I understand all this correctly, as is, this access caller's topic is an unrestricted

Re: Unifying invocant and topic naming syntax

2002-11-13 Thread Luke Palmer
Date: Wed, 13 Nov 2002 20:34:49 + From: Nicholas Clark [EMAIL PROTECTED] If a subroutine explicitly needs access to its invocant's topic, what is so wrong with having an explicit read-write parameter in the argument list that the caller of the subroutine is expected to put

Access to caller's topic (was Re: Unifying invocant and topic naming syntax)

2002-11-13 Thread Me
access caller's topic is an unrestricted licence to commit action at a distance. Right. Perhaps: o There's a property that controls what subs can do with a lexical variable. I'll call it Yours. o By default, in the main package, topics are set to Yours(rw); other lexicals are set

Re: on Topic

2002-11-13 Thread fearcadi
Larry Wall writes: Correct, $_ is always lexical. But... : or * will it be implicitely my $_ -- class/package lexical There's no such thing as a class/package lexical. I think you mean file-scoped lexical here. ooo, now I understand : *scope* is orthogonal concept to

Re: Unifying invocant and topic naming syntax

2002-11-13 Thread Andrew Wilson
On Wed, Nov 13, 2002 at 08:34:49PM +, Nicholas Clark wrote: If a subroutine explicitly needs access to its invocant's topic, what is so wrong with having an explicit read-write parameter in the argument list that the caller of the subroutine is expected to put $_ in? It's the difference

Re: on Topic

2002-11-13 Thread Larry Wall
On Thu, Nov 14, 2002 at 04:28:17AM +0200, [EMAIL PROTECTED] wrote: : : : will it be an error to declare it as our $_ ; : : No, in this case, $_ is still considered a lexical, but it just happens : to be aliased to a variable in the current package. : : : which variable ? it seems

Re: Unifying invocant and topic naming syntax

2002-11-11 Thread Damian Conway
confirm that one can't do: sub f ($a = mumble) { ... } or sub f (;$_ = mumble) { ... } where mumble is the upscope it and $_ is the sub's topic. I seriously doubt it but, as always, that's up to Larry. If it were allowed, the syntaxes might be something like: sub f ($a = $CALLER

Re: Unifying invocant and topic naming syntax

2002-11-11 Thread Me
$^_ }; # shorthand for $foo = sub { print $_ } is given($_); If you're proposing that there be some special exemption for $^_ so that it (a) doesn't placehold a parameter and (b) aliases the caller's topic instead Well it clearly does placehold something. In method f ($self

Re: Unifying invocant and topic naming syntax

2002-11-11 Thread Damian Conway
exemption for $^_ so that it (a) doesn't placehold a parameter and (b) aliases the caller's topic instead Well it clearly does placehold something. Sure. It's placeholds a parameter named $^_, which may or may not be equivalent to a parameter named $_ (Larry will need to rule on that bit

Re: Unifying invocant and topic naming syntax

2002-11-11 Thread Me
method f ($self : $a) { ... } sub f ($a) is given ($line) { ... } what do you call $self The invocant. and $line? A lexical variable that happens to be bound to the caller's topic. The invokit perhaps? placeholders create subroutines, not methods. Oh

Re: Unifying invocant and topic naming syntax

2002-11-07 Thread Damian Conway
ralph wrote: My estimate (based on the -- not inconsiderable -- code base of my own modules) is closer to 5%. Your estimate of what others will do when knocking out 10 line scripts in a hurry, or what's in your current p5 modules? Both. Can currying include the given topic? sub bar

on Topic

2002-11-07 Thread fearcadi
I just want to be sure I understand correctly : In your article at perl.com you describes various ways and situations when perl creates a topic and this is described as perl making the following binding on my behalf: $_ := $some_var ; *1* and probably marking $_ with some additional

Re: on Topic

2002-11-07 Thread Me
In the hope this saves Allison time, and/or clarifies things for me, I'll attempt some answers. In your article at perl.com you describes various ways and situations when perl creates a topic and this is described as perl making the following binding on my behalf: $_ := $some_var ; *1

Re: on Topic

2002-11-07 Thread fearcadi
Me writes: In the hope this saves Allison time, and/or clarifies things for me, I'll attempt some answers. Thanks . In your article at perl.com you describes various ways and situations when perl creates a topic and this is described as perl making the following binding

Re: Unifying invocant and topic naming syntax

2002-11-07 Thread Me
is the upscope it and $_ is the sub's topic. Can currying include the given topic? Maybe. Naturally, I see this as another symptom of the way upscope it is being treated as a second class citizen, and that this is leading things in the wrong direction. And what about a topic placeholder

Re: on Topic

2002-11-07 Thread Larry Wall
On Thu, Nov 07, 2002 at 01:36:07PM -0600, Me wrote: : is *1* _all_ that topic is about ? : : Sorta. To quote an excellent summary: : : Topic is $_. A real topicalizer also sets a topicalizer scope that can be broken out of. : also : : a := ( $a, $b) : : Er, I don't think

Re: Unifying invocant and topic naming syntax

2002-11-05 Thread Damian Conway
ralph hypothesized: My imagination suggests to me that in a typical short perl 6 script, between 20% and 50% of all sub defs would use the upscope topic... ; That's some imagination you've got there! ;-) My estimate (based on the -- not inconsiderable -- code base of my own modules) is closer

Re: Unifying invocant and topic naming syntax

2002-11-05 Thread Allison Randal
On Tue, Nov 05, 2002 at 05:13:45AM -0600, Me wrote: relatively few subroutines need access to the upscope topic. Well, this is a central issue. What are the real percentages going to be here? Just how often will one type the likes of - is given($foo is topic) { ... } rather

Re: Unifying invocant and topic naming syntax

2002-11-04 Thread Allison Randal
On Sun, Nov 03, 2002 at 11:17:32PM -0600, Me wrote: I started with a simple thought: is given($foo) seems to jar with given $foo { ... } One pulls in the topic from outside and calls it $foo, the other does the reverse -- it pulls in $foo from the outside and makes

Re: Unifying invocant and topic naming syntax

2002-11-04 Thread Me
(naming) the invocant of a method involves something very like (naming) the topic Generally, there's no conceptual link... other than The similarity is that both are implicit parameters which was my point. Almost the entirety of what I see as relevant in the context of deciding

Re: Unifying invocant and topic naming syntax

2002-11-04 Thread Damian Conway
ralph wrote: It's clear you could have come up with something like one of these: method f ($a, $b) is invoked_by($self) method f ($a, $b) is invoked_by($self is topic) method f ($a, $b) is invoked_by($_) but you didn't. Any idea why not? Because most methods need some kind

Unifying invocant and topic naming syntax

2002-11-03 Thread Me
I read Allison's topicalization piece: http://www.perl.com/pub/a/2002/10/30/topic.html I started with a simple thought: is given($foo) seems to jar with given $foo { ... } One pulls in the topic from outside and calls it $foo, the other does the reverse -- it pulls in $foo from