Re: conditional wrapper blocks

2005-09-22 Thread Shane Calimlim
Excuse my noobness, I really have no idea about any of the inner workings, but am just concerned with a more elegant syntax of doing it. How about something like: if ($condition) { pre; always { # maybe uncond instead of always, or both -- always could # mean 'ignore all conditions' and uncond

Re: conditional wrapper blocks

2005-09-22 Thread Stuart Cook
On 22/09/05, Shane Calimlim [EMAIL PROTECTED] wrote: How about something like: if ($condition) { pre; always { # maybe uncond instead of always, or both -- always could # mean 'ignore all conditions' and uncond could mean # 'ignore the current block's condition mid_section; } post; }

Re: conditional wrapper blocks

2005-09-21 Thread TSa
HaloO, Yuval Kogman wrote: Today on #perl6 I complained about the fact that this is always inelegant: if ($condition) { pre } unconditional midsection; if ($condition) { post } I'm not sure if you would considered closure traits as equally inelegant but what are PRE

Re: conditional wrapper blocks

2005-09-21 Thread Yuval Kogman
On Tue, Sep 20, 2005 at 21:09:09 +0200, Juerd wrote: Mark Reed skribis 2005-09-20 14:31 (-0400): This has so little redundancy that it makes very little sense to want to avoid repeating that very short encode_entities($item-label). The fine line is when the midsection is slightly more than

Re: conditional wrapper blocks

2005-09-21 Thread Mark Reed
On 2005-09-21 03:53, Yuval Kogman [EMAIL PROTECTED] wrote: On Tue, Sep 20, 2005 at 21:09:09 +0200, Juerd wrote: Mark Reed skribis 2005-09-20 14:31 (-0400): This has so little redundancy that it makes very little sense to want to avoid repeating that very short encode_entities($item-label).

Re: conditional wrapper blocks

2005-09-21 Thread Yuval Kogman
On Wed, Sep 21, 2005 at 09:54:33 -0400, Mark Reed wrote: Watch the attributions, please. I didn't write the above text - Juerd did. Sorry, I must have gotten confused when I was snipping -- () Yuval Kogman [EMAIL PROTECTED] 0xEBD27418 perl hacker /\ kung foo master: /me supports the

conditional wrapper blocks

2005-09-20 Thread Yuval Kogman
Today on #perl6 I complained about the fact that this is always inelegant: if ($condition) { pre } unconditional midsection; if ($condition) { post } Either you put the condition in a boolean var and check it twice, or you use a higher order function and give it three

Re: conditional wrapper blocks

2005-09-20 Thread Yuval Kogman
On Tue, Sep 20, 2005 at 18:19:42 +, [EMAIL PROTECTED] wrote: Some other possible problems: 1: if $condition is an expression with side-effects then your new construct has a different meaning then the original code. If it has side effects then I always my $bool = test ... ; if

Re: conditional wrapper blocks

2005-09-20 Thread Matt Fowles
Yuval~ On 9/20/05, Yuval Kogman [EMAIL PROTECTED] wrote: Today on #perl6 I complained about the fact that this is always inelegant: if ($condition) { pre } unconditional midsection; if ($condition) { post } I asked for some ideas and together with Aankhen we

Re: conditional wrapper blocks

2005-09-20 Thread Mark Reed
On 2005-09-20 14:23, Yuval Kogman [EMAIL PROTECTED] wrote: On Tue, Sep 20, 2005 at 18:19:42 +, [EMAIL PROTECTED] wrote: 2: if the middle part does something that changes the value of the expression $condition then the new construct again has a different meaning. Err, that's the point

Re: conditional wrapper blocks

2005-09-20 Thread Yuval Kogman
On Tue, Sep 20, 2005 at 14:31:07 -0400, Mark Reed wrote: On 2005-09-20 14:23, Yuval Kogman [EMAIL PROTECTED] wrote: On Tue, Sep 20, 2005 at 18:19:42 +, [EMAIL PROTECTED] wrote: 2: if the middle part does something that changes the value of the expression $condition then the new

Re: conditional wrapper blocks

2005-09-20 Thread Juerd
Yuval Kogman skribis 2005-09-20 20:33 (+0300): Today on #perl6 I complained about the fact that this is always inelegant: if ($condition) { pre } unconditional midsection; if ($condition) { post } I believe it's not inelegant enough to do something about. The unconditional

Re: conditional wrapper blocks

2005-09-20 Thread Juerd
Mark Reed skribis 2005-09-20 14:31 (-0400): Not necessarily. Consider this common idiom (in pseudo-perl5): Common, but widely regarded as bad style. The solution is templating and factoring in templates. But disregarding that, The trick is to not see it as pre; midsection; post; versus

Re: conditional wrapper blocks

2005-09-20 Thread John Macdonald
On Tue, Sep 20, 2005 at 08:58:41PM +0200, Juerd wrote: Yuval Kogman skribis 2005-09-20 20:33 (+0300): Today on #perl6 I complained about the fact that this is always inelegant: if ($condition) { pre } unconditional midsection; if ($condition) { post } I believe it's not

Re: conditional wrapper blocks

2005-09-20 Thread mark . a . biggar
Some other possible problems: 1: if $condition is an expression with side-effects then your new construct has a different meaning then the original code. 2: if the middle part does something that changes the value of the expression $condition then the new construct again has a different