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

World: r3wp

[!REBOL3-OLD1]

BrianH
30-Sep-2009
[18484]
Rules that don't advance.
Henrik
30-Sep-2009
[18485]
if a rule constitutes the part in the block and the block is empty, 
I don't see how that is useful.
Sunanda
30-Sep-2009
[18486]
I think the 'some loop highlights the important need to extend 'secure 
to cover parse.

That's an effective way to rein in loops on dynamic / user contributed 
parses -- such as Henrik's / Kaj's "Try REBOL 3" web sites.
Maxim
30-Sep-2009
[18487]
as steeve says... forever [] isn't usefull either.  at some point 
you have to understand a bit of what you are doing.


the only thing that really happens to me is hitting the end, and 
not realizing that something in my some or any is preventing the 
rule to go "past" the end.
Steeve
30-Sep-2009
[18488]
if the empty block is constructed later, it can be useful to not 
prevent their existing
Henrik
30-Sep-2009
[18489x2]
Sunanda, yes, that's one reason I halted the project.
Steeve, would it be empty right at parse time?
BrianH
30-Sep-2009
[18491]
Henrik, the problem is not that the rule is empty, it is that the 
rule doesn't advance the position. Complex rules can not advance 
too.
Steeve
30-Sep-2009
[18492]
yes, but not with some [ ] or any [ ]
Henrik
30-Sep-2009
[18493x2]
BrianH, but empty rules do per definition not advance. Why not per 
definition then cause an error?
I can see that all situations can't possibly be avoided, but these 
stupid little ones, I'm sure they can.
BrianH
30-Sep-2009
[18495]
It's irrelevant. Empty rules are easy to debug, so that won't be 
a problem for beginners. It's when complex rules don't advance that 
is the problem.
Henrik
30-Sep-2009
[18496]
I disagree that it's irrelevant. It's hellishly annoying to have 
to wait for the parser to finish on an empty rule, when you are working 
with PARSE in the console.
Ladislav
30-Sep-2009
[18497]
Don't be that short-sighted, Henrik. Since the Parse dialect is intended 
to be Turing complete, there is no way how to "automagically" detect 
all such cases!
BrianH
30-Sep-2009
[18498]
Removing support for PARSE [some []] means removing support for PARSE 
[] - inner blocks work through recursion.
Henrik
30-Sep-2009
[18499]
Ladislav, how hard is it to detect an empty rule and cause an error?
Ladislav
30-Sep-2009
[18500]
you really mean it, that forever [] should be automatically implemented 
to cause an error?
BrianH
30-Sep-2009
[18501]
Sunanda, SECURE 'eval already covvers PARSE.
Henrik
30-Sep-2009
[18502]
Ladislav: I don't know? It seems like a good idea and it's a bad 
way to pause a script. Rather use WAIT. But it's unrelated to empty 
rules as they are a side effect of PARSE.
Steeve
30-Sep-2009
[18503]
not for PARSE currently IIRC
Sunanda
30-Sep-2009
[18504]
Secure doc say: <For example, PARSE cycles are not yet counted.>
http://www.rebol.com/r3/docs/functions/secure.html
BrianH
30-Sep-2009
[18505]
Ah, well that should be fixed then :(
Steeve
30-Sep-2009
[18506]
i hope they will be never counted, because it will slow down the 
process...
Ladislav
30-Sep-2009
[18507]
Henrik, forever [] and some [] are unrelated just for you; not for 
me.
Sunanda
30-Sep-2009
[18508]
Clearly there has been some internal change in the handling of empty 
rules:
   parse [] [some []]
R3: ends immediately
R2: takes 90+ seconds
Henrik
30-Sep-2009
[18509]
Sunanda, so that's why I thought it was fixed...
Steeve
30-Sep-2009
[18510]
and there is a more common error which cause endless loop in parse
some [... | ....| .... | ]   <- nothing after the last |
Henrik
30-Sep-2009
[18511x2]
Ladislav, ok how often do you use forever [], then?
Steeve, precisely!
Maxim
30-Sep-2009
[18513]
but you might want the parse to loop forever.
BrianH
30-Sep-2009
[18514]
Well, that's new, Sunanda. Steeve, an empty alternate is the same 
as none.
Steeve
30-Sep-2009
[18515]
precisely what ?
you can't establish a list of all the bad coding practices
Maxim
30-Sep-2009
[18516]
since some of the rules in steeves example aren't empty.
Henrik
30-Sep-2009
[18517]
Steeve, there is an empty rule. (it seems that we can't agree what 
a rule actually is)
BrianH
30-Sep-2009
[18518]
That is why we have ?? and TRACE.
Maxim
30-Sep-2009
[18519x2]
I have ending rules which switch on/off on the fly.
(become none or are suddenly filled with a condition which enables 
an exit)
BrianH
30-Sep-2009
[18521]
An empty rule is a legitimate shortcut for none, and is not necessarily 
an error either as an empty rule or as none..
Maxim
30-Sep-2009
[18522]
I also have rules which are self-modifying based on content.  the 
last item in the some [... | ....| .... | ]  can be added on the 
fly.
Henrik
30-Sep-2009
[18523]
Maxim, but is the rule empty at parse time?
BrianH
30-Sep-2009
[18524]
AND, NOT, STAY, IF and REMOVE don't advance either, and OPT might 
not advance.
Maxim
30-Sep-2009
[18525x2]
the only specific instance which is a valid "trappable" nop is 
parse data [some []]
the moment the rule after some has some content, its possible it 
will modify rules on the fly... so AFAICT by sunanda's examplel above, 
is that Carl already addressed the purely empty rule in R3, but a 
rule with content which has an empty "ending" rule, that must be 
allowed, its part of the features of Parse.
Henrik
30-Sep-2009
[18527]
if the end result is a hang per definition, is the empty rule then 
of any practical use?
Ladislav
30-Sep-2009
[18528]
how often do I use forever [] ? I guess that exactly as often as 
some [].
BrianH
30-Sep-2009
[18529]
Given that the actually emmpty rule case is also the most likely 
to be caught by a simple visual scan, is it worth special-casing?
Ladislav
30-Sep-2009
[18530]
My POV is, that such rules have to be handled "regularly", for teaching 
purposes. It does not make any sense to me to special-case these.
Henrik
30-Sep-2009
[18531]
BrianH, how do you visually inspect:

parse [a b c] [some my-rule]
... 100000 lines later...
my-rule: []
BrianH
30-Sep-2009
[18532]
It would be the same with a rule containing none, not if, and stay, 
opt, remove, insert, change, parens. Why special-case the easiest?
Steeve
30-Sep-2009
[18533]
Awww, it will never append.
1/ there's not such monstruous script with Rebol.
2/ Bad coding practice, you don't respect locality