Hi List,
I'm trying to encapsulate a parse operation into a simple function. No problem
on this side.
However as the function evolves I want to use a block! parameter instead of a
string! parameter
for what seemed an obvious process to me in the beginning but apparently such
is not the case...
Here is the function, its parameter and the nature of the information :
The original is:
==========
print-align: func [params [string!]] [
if parse params align-rules/expr [
;Here the parse extracts 3 values : a print-value, an adjust-sign and
a print-len.
; The there is a call to another function called print-justify
print-justify print-value adjust-sign print-len
]
]
This function is called as: print-align "22.5 << 10" (spacing is not important
so I could
have written "22.5<<10".
The result is : "22.5 "
(6 spaces are added to the right since the alignment is done at left).
Now for the new one
===============
print-align: func [params [block!]] [
if parse trim to-string params align-rules/expr [
;Here I also want the parse to extract 3 values :
; a print-value, an adjust-sign and a print-len.
; The there is a call to another function called print-justify
print-justify print-value adjust-sign print-len
]
]
This function should now be called as:
print-align [22.5 << 10] (I also would like spacing to be not important so I
could
have written [22.5<<10].
The wanted result is : "22.5 "
(6 spaces are added to the right since the alignment is done at left).
But instead of this result I get the following error message since REBOL tries
to
evaluate each element inside the params block and the process never goes on
past this point. Finally the block-to-string conversion never goes on since
REBOL rejects the second parameter (<<).
Is there a way to disable this way of doing things REBOL has when faced with
an illicit params block, a bit like when we create a flat block and have to
force
the evaluation when needed ?
If no other way to do it, I will continue with strings but this could have
simplified
things from a user point of vew.
Thanks,
Gerard
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.