Sunanda et al.
thanks for asking me to post an example of encompass in action. I, myself, was
looking for meaningfull examples, and its fun to have one in the context of a real
problem.
here is an example of how to patch load so that the /all refinement works as expected.
I have used the method of Romano (hope you don't mind... I take no credit for that :-)
to safely load the header (with a tiny improvement which allows me to find the 'rebol
word even if its not at the begining.
rload: :load
load: encompass/pre 'rload [
; check if header refinement was used
if header [
; header and library modes are not compatible (but could be).
if not library [
; the /all refinement is the ONLY case where the header should
not be read
if all [
; source is defined in load, so it will have the same
meaning here
if string! <> type? source [
source: read source
]
; at this point we ARE SURE TO HAVE TEXT!
; source: a
if source: script? find source "rebol" [
attempt [source: construct/with first
load/next
find source "[" system/standard/script]
]
return source ; this will actually shortcut the load
call.
]
]
]
]
script: {rebol [author: "someone" needs: [view 2.0.0]] gkjnfdkljhn dfihroih ro[h rtoi }
; --- THIS WILL WORK !!! ---
probe load/header/all script
; --- THIS WILL FAIL (which is expected) !!! ---
probe load/header script
Hope this helps.
-MAx
> === Original Message ===
>
>
> Max:
>
> > damn I was about to show you a way of doing it with encompass... :-)
>
> > That is its main purpose... fixing/improving/limiting things around...
>
> while
> > still keep the basic functionality.
>
> I'd appreciate seeing some more examples of what encompass can do -- it's
>
> often hard to see all the possibilities of a new tool without being spoon-fe
> d
> some inspiration first.
>
> If you have some examples of using encompass to add goodies, it might be
> worth adding them to the documentation in the Library.
>
> >
> > I wish I could rebol full time.
> >
> Ah, me too!
>
> Sunanda.
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.