r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3]

Andreas
12-Mar-2010
[1544]
This would then leave us with the "classical" Common Lisp-style use 
of named catch/throw for non-local exits. And for this use-case, 
a definitionally scoped name would certainly be the right thing to 
do, imho.
Gregg
12-Mar-2010
[1545]
Maarten and I used a named throw in a proejct for Qtask, but I don't 
use it much. The question is, *should* we use it more, and what are 
the scenarios? It does make some handling read cleaner to me. 

Maybe Carl can say what he envisioned when he designed it.
BrianH
12-Mar-2010
[1546x3]
Ladislav, your B-CATCH/B-THROW example is similar to what I suggested 
in an earlier comment, but in code form. Nice code :)
And I use names CATCH and THROW.
I never tried to catch a named throw without a named catch. If that 
is possible, that is a major bug and should be reported.
Gregg
12-Mar-2010
[1549]
It's possible in R2. CATCH returns the name it caught.
BrianH
12-Mar-2010
[1550x4]
It's possible in R3 as well. I'll report it later.
Extept CATCH returns the value, not the name. Even worse.
Andreas, in R3 :result means GET/any 'result.
Sorry, Ladislav mentioned that already.
Gregg
12-Mar-2010
[1554]
Is it a bug, or by design though? i.e. it's a general catch. If the 
name gets lost on a named throw, that seems an obvious oversight 
in the design.
BrianH
12-Mar-2010
[1555x2]
That sounds like an error that should be reported by the console. 
A named throw that doesn't have a corresponding named catch should 
be treated like it doesn't have a catch at all.
We use THROW/name to write sandboxed replacements for the unwind 
functions, non-local dynamic escape functions, etc. But that only 
works if CATCH doesn't catch it.
Gregg
12-Mar-2010
[1557]
If that was the original design intent, then I agree.
BrianH
12-Mar-2010
[1558x4]
Reported in bug#1518.
Andreas, the meaning of "non-local" we have been using is code that 
is *not* in a nested block or paren. Instead, the code is in another 
function, a block defined elsewhere, whatever. Definitional scoping 
will only work for local code, meaning code that is in nested blocks. 
We have to define locality relative to the catch, not the throw, 
because the catch function is what defines the scoping.
Gregg, CATCH is not a general catch: There is already the /quit option 
that makes it catch more than it normally would.
Steeve, you might be amused to find out that the DO intrinsic currently 
depends on bug#1509 and does need a [throw] attribute. Though it 
still wouldn't work with definitional RETURN because of binding issues. 
C'est la vie.
Steeve
12-Mar-2010
[1562]
I'm working on an FIRE effect for R3, that's how I might be amused 
:)
Gabriele
13-Mar-2010
[1563]
Brian, if a simple CATCH should not catch named throws then we need 
a CATCH/ALL (not sure if /QUIT should be it).
Andreas
13-Mar-2010
[1564x2]
Gabriele, Brian requested such a thing (CATCH/ALL) as bug#1520.
Though he wants bug#1520 to catch all other unwinds (BREAK, CONTINUE, 
RETURN, EXIT) as well, to which I see no merit.
BrianH
13-Mar-2010
[1566x3]
The advantage to that is because on those rare occasions when you 
actually need to catch all THROW and THROW/name unwinds, you most 
likely need to catch the rest too. You might note that the emergency 
exceptions - HALT, QUIT/now, errors - aren't proposed to be caught, 
because the cleanup code would likely interfere with error recovery 
code or the debugging process.
Most of the time you really don't want THROW/name caught by code 
that it isn't intended for. When you really want to catch off-topic 
stuff, you want to catch everything.
However, HALT is used for debugging (which is why CATCH/quit doesn't 
catch it), QUIT/now is supposed to always quit, and you want errors 
to get through so you see them, so those make sensible exceptions.
Paul
14-Mar-2010
[1569x2]
Can someone else confirm if they get a problem with the following 
ajoin [newline "blah" crlf]
I don't get the problem on windows but do get it on my webhost (linux)
BrianH
14-Mar-2010
[1571]
It looks good here on Windows. What problem do you see?
Paul
14-Mar-2010
[1572]
yeah works find on windows
BrianH
14-Mar-2010
[1573x2]
Can you copy the Linux output here?
(I have a theory, but need confirmation)
Paul
14-Mar-2010
[1575x4]
recreating - hold on
weird - this time it works.
before I would get "^^/blah^M^/"
I would get a double ^
BrianH
14-Mar-2010
[1579]
Strange.
Paul
14-Mar-2010
[1580]
yeah not sure why
BrianH
14-Mar-2010
[1581]
Heisenbug?
Paul
14-Mar-2010
[1582]
?
BrianH
14-Mar-2010
[1583]
It means a bug that goes away when you observe it (or go looking 
for it). Referring to Heisenberg's Uncertainty Principle.
Paul
14-Mar-2010
[1584]
ahhh yeah
BrianH
14-Mar-2010
[1585]
Andreas, I put a comment in bug#1520 that should deal with your concerns. 
Take a look.
Gregg
15-Mar-2010
[1586]
R2 console allows this: %"_%test%_.r"  But R3 does not. You have 
to use the escaped version: %"_%25test%25_.r"
BrianH
16-Mar-2010
[1587]
Right. That was fixed in R3 recently.
Gregg
16-Mar-2010
[1588]
Cool. Thanks.
BrianH
16-Mar-2010
[1589x4]
Just to make it clear: The behavior you describe in R3 was the result 
of the fix :)
bug#1443 to be specific.
Though for file! literals it was like that before, afaik. #1443 extended 
that to email! and url! literals.
I understand your take on Carl's proposal for a change in RETURN 
and EXIT scoping, but it needs some work before it can do the job. 
For one thing, if you have dynamic as an option (or a default) there 
is still the need for something like R2's [throw] attribute. And 
if definitional is an option, not the default, then I'm having a 
lot of trouble justifying that option, especially since it doesn't 
solve the [throw] issue or bug#1506. It seems to me that the main 
reason for definitional is to make a simpler default for less advanced 
developers. If it's an option that the user has to chose, it doesn't 
serve that purpose. And if it's an option that gets conflated with 
the option to specify a typespec for the return value of the function, 
then this is going to get Fork furious about making REBOL more confusing, 
and he'll be right this time.
Ladislav
16-Mar-2010
[1593]
how about this, is it intended?
>> f:  func [self] [self]
** Script error: duplicate variable specified: self
** Where: make func
** Near: make function! copy/deep reduce [spec body]