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

World: r3wp

[!REBOL3-OLD1]

BrianH
13-Jun-2009
[15394]
I'd like to backport the R3 module system, but the use of the Needs 
header might be awkward.
Maxim
13-Jun-2009
[15395]
yeah... maybe carl can just add a hook for you in the loader.
BrianH
13-Jun-2009
[15396]
At least the Core version need syntax is compatible...
Maxim
13-Jun-2009
[15397x2]
yesss, I have the basic features of vprint working in R3... no code 
changes where needed  :-)
can now move ahead with liquid.
BrianH
13-Jun-2009
[15399]
Cool. You should have enough rank to post files - tell me if you 
have difficulty.
Maxim
13-Jun-2009
[15400x4]
there is one thing That I did not see documented... how can I get 
the modules to print errors from within?  I just get:
** access error: cannot open: %liquid.r3 reason: none
this is impossible to use for development.
in this case it was a mismatched "  character.
I can't imagine trying to corner that in a 50kb module!
BrianH
13-Jun-2009
[15404x2]
Don't get what you are saying. Is the access error something that 
happens when you try to print from within, or what you want to print?
Or do you want line numbers in your syntax errors or something?
Maxim
13-Jun-2009
[15406x3]
when the application script loaded the module, it printed above message. 
 but the real error was that the module had a mismatched " char...
the same error in the main script would have given a real error... 
 ** Syntax error: invalid "string" -- {"}
python give you the file name and the normal error after... so you 
know where that happened.
BrianH
13-Jun-2009
[15409]
So it was a load error then? Interesting that it would return that 
error - I've never seen the like, and modules and scripts are loaded 
the same, with the same code even.
Maxim
13-Jun-2009
[15410]
yes error on load... it seems that other errors report the error 
correctly.
BrianH
13-Jun-2009
[15411]
Well, LOAD loads scripts and modules alike. Where was the mismatched 
", header or code?
Maxim
13-Jun-2009
[15412x3]
code.
loading a module twice crashes rebol.  :-(
even if its being loaded from different contexts.   

I tried importing vprint in main app and within liquid module... 
I get an "assertation failed" error.
BrianH
13-Jun-2009
[15415]
You need to post example code when you find these things out - otherwise 
we can't fix things.
Maxim
13-Jun-2009
[15416x2]
sure! like I did with the needs header   ;-)   hehehe
ok, so I'll add a CC ticket for the load error.
BrianH
13-Jun-2009
[15418]
At least post the exact assertion failed error message.
Maxim
13-Jun-2009
[15419]
I guess I'm going to give R3 modules a run for their money  ;-)
BrianH
13-Jun-2009
[15420]
Speaking of which, I'm trying to backport a subset of the ASSERT 
function to R2. It's kicking my ass so far :(
Maxim
13-Jun-2009
[15421]
created two new tickets.
BrianH
13-Jun-2009
[15422]
If you import files rather than names, the file gets imported twice. 
Clearly there is something in your %vprint.r3 that causes an assertion 
when reloaded. Have you tried DOing the file twice?
Maxim
13-Jun-2009
[15423x2]
doing is ok... just tested that
was about to post my workaround.
BrianH
13-Jun-2009
[15425]
Have you tried renaming the file to %vprint.r, giving it a Name: 
'vprint header, and importing it lilke Needs: [vprint] or IMPORT 
'vprint ?
Maxim
13-Jun-2009
[15426x3]
note, I had to remove the type: 'module in the header for it to work
haven't used the word based module handling, but the vprint module 
already has a name: vprint in the header.
Name: 'vprint  

to be precise
BrianH
13-Jun-2009
[15429x2]
If you want the module to be referenced in the module registry so 
it doesn't get reloaded you need to do the word-based module style.
I think - let me trace the code.
Maxim
13-Jun-2009
[15431x3]
I actually WANT the module to be loaded twice cause I want each context 
to have its own verbosity control to be independent...  but my current 
attempt at using files was not in that goal, it was really just to 
support  .r3 extensions.
although its possible that import copies and rebinds each import 
to the current context, so that its
.... so that its unessary to perform the disk I/O twice.
BrianH
13-Jun-2009
[15434]
Think I found an error in IMPORT - a <= where it should be a <, and 
a >= where it should be a >. I think the file thing shouldn't affect 
it.
Maxim
13-Jun-2009
[15435x2]
using word based import or needs still cause the bug.
(still crashes rebol)
BrianH
13-Jun-2009
[15437]
You want the module to be loaded and done once, but imported twice. 
Doing the module code more than once wouldd usually be bad.
Maxim
13-Jun-2009
[15438]
shared and distinct/copied modules should both be supported.  right 
now I am not sure which one R3 does but, it doesn't provide the capabilities 
to do both, AFAICT.
BrianH
13-Jun-2009
[15439x2]
It's shared if you give the module a name header.
Not shared if not.
Maxim
13-Jun-2009
[15441]
ok. that should be more explicit in the docs... its sort of mentionned 
(implied?) but not as obvious as the above sentence.
BrianH
13-Jun-2009
[15442]
I think you have to import it by word too to share, but I'm still 
tracing.
Maxim
13-Jun-2009
[15443]
strange bug... If I only
 do %vprint.r3

in the module and try to use a function from vprint, I get an error:

vprint loaded
** Script error: von word is not bound to a context

** Where: do applier make if import catch if either either do begin 
do
** Near: do body obj

vprint loaded
 is a probe statement executed within the vprint.r3 file