World: r3wp
[Core] Discuss core issues
older newer | first last |
Anton 4-Apr-2008 [10151x2] | See my code above. |
That still doesn't stop BIND? actually... Need to unset 'bind? as well :) | |
[unknown: 5] 4-Apr-2008 [10153] | that could cause way to many problems I would assume. |
BrianH 4-Apr-2008 [10154x4] | If your code can reference a word, then code that treats your code as data can reference the word in R2. |
If you want to sandbox R2, you have to sandbox the functions that can turn your code into data - that means the ordinals. | |
That will make the sandboxed code slow though, since it would mean PICK and the ordinals would be mezzanines. | |
R3 doesn't have that problem, since the ordinals are not used to turn code into data - another function is. Sandboxed code wouldn't need to have a reference to that function at all, or any functions that call it. | |
btiffin 5-Apr-2008 [10158x2] | Working on locate.r; saving a database after a scan of the library scripts can't be reloaded autoextract.r has the following inside it: output: [{Self-extracting REBOL-compressed file REBOL [ Title: "Self-extracting compressed file" Date: } now { File: } mold infile { Author: "Autoextract function by Bohdan Lechnowsky" Comment: ^{ Simply run this script and it will decompress and save the file for you ^} ] if exists? } mold infile { [ print ["} infile { already exists, please rename" " existing file and run again."] halt ] write } mold infile { decompress 64#} mold file ] write outfile to-string reduce output How do I get REBOL to keep the ^{ and ^} across a save/all and load? locate.r keeps a reference to all block! info for the tour sequence. LOADing this (after a SAVE/ALL) causes an invalid string error. Any hints? |
Oh, and the code is passed thru the pretty-print parser (to build up the references) before the save/all | |
Graham 5-Apr-2008 [10160x3] | one of my pet peeves is that to-block craps out if it encounters an unknown datatype |
why can't there be an option to turn illegal datatypes into strings ... | |
I'm using to-block so that I can use block parsing of course | |
btiffin 5-Apr-2008 [10163] | Yeah, me too ... always. But R3 TRANSCODE can trap that now ... umm, I just don't get the whole LOAD/NEXT thingy in context of parsing over block! and paren! Gabriele has posted links, just never dug in. |
Graham 5-Apr-2008 [10164x2] | >> to-block "23 May, 2008" ** Syntax Error: Invalid word -- May, ** Near: (line 1) 23 May, 2008 |
Ok, now why is "," in particular not allowed in a word? | |
btiffin 5-Apr-2008 [10166x2] | Has anyone ever detailed the voodoo of caret escapes in strings? ^^^{ does not return ^{ as I read it should. It's ==ing as ^^{, but I'm not sure if this a post process of the == result display. ?? Seems like voodoo. And instead of exploring, I'd rather just read something this time. |
Having nothing intelligent to add - to me the comma is a little voodoo too; I'll just ditto your sentiment. | |
Graham 5-Apr-2008 [10168] | which function allows me to traverse a series and remove at the same time? |
btiffin 5-Apr-2008 [10169x2] | remove-each |
Or while? | |
Graham 5-Apr-2008 [10171x4] | cool |
how's this >> date: "* 10 May, 2008" == "* 10 May, 2008" >> d: parse date none == ["*" "10" "May" "2008"] >> remove-each b d [ not any [ parse b alphas parse b digits ] ] == ["10" "May" "2008"] >> d: to-block form d == [10 May 2008] | |
I'm trying to clean up OCR'd text prior to parsing | |
to end up only with integers and alphas ... is this bullet proof? | |
Henrik 5-Apr-2008 [10175] | >> to-block "3a" ** Syntax Error: Invalid integer -- 3a Not entirely... |
Graham 5-Apr-2008 [10176x2] | it won't pass my parse rule |
I parse digits and chars separately .. I'm not using an alphanumeric parse | |
Henrik 5-Apr-2008 [10178] | ok, if that's the case, you should be fine. |
btiffin 5-Apr-2008 [10179] | Yeah I'm playing too ... |
Graham 5-Apr-2008 [10180] | I'm sure the parse gurus can do this all in one parse rule! |
btiffin 5-Apr-2008 [10181x2] | I wanna junk! datatype ... parsed (made / loaded) up to next space during interpret. Then we could read scripts modified by normal people. Might be a lot of junk! but I'd rather write a junk! handler than try and trick REBOL. |
read = load | |
Graham 5-Apr-2008 [10183x2] | yeah ... that would be neat. |
I'd call it crap! though | |
Anton 6-Apr-2008 [10185x4] | date: "* 10 May, 2008" allowed: union union alpha digit charset " " parse remove-each char date [not find allowed char] none == ["10" "May" "2008"] |
but you got a problem with this date: "10 May,2008" ---> ["10" "May2008"] | |
date: "10 May,2008" parse replace/all date complement allowed " " = ["10" "May" "2008"] date: "* 10 May, 2008" parse replace/all date complement allowed " " == ["10" "May" "2008"] | |
which passes a charset to to REPLACE. | |
Henrik 9-Apr-2008 [10189x2] | >> a: [(i)] == [(i)] >> repeat i 5 [print i compose a] 1 ** Script Error: i has no value ** Where: halt-view ** Near: i >> repeat i 5 [print i compose load mold/all a] 1 ** Script Error: i has no value ** Where: halt-view ** Near: i Is that correct? I'm obviously missing something, but I don't know what. Does COMPOSE not work inside the REPEAT context? >> b: ['i] == ['i] >> repeat i 5 [print i reduce b] 1 2 3 4 5 == [i] This works as expected. |
solved it: >> a: [(i)] >> repeat i 5 [print i compose bind a 'i] 1 2 3 4 5 == [5] I assumed that LOAD MOLD/ALL would kill the existing bindings and re-bind it to whatever context it was being run in. I guess it doesn't do that. | |
Anton 9-Apr-2008 [10191] | I think LOAD just binds to global context. |
Henrik 9-Apr-2008 [10192] | yes, I think it does. |
Geomol 9-Apr-2008 [10193] | :-/ Yeah, that must be the answer. Do we need a /local (or something) refinement for LOAD? |
Anton 9-Apr-2008 [10194x2] | c: context [print: "local" w: load "print"] type? get c/w ; == native! |
Geomol, why add another refinement when you can just use BIND, which allows you to bind it anywhere ? | |
Geomol 9-Apr-2008 [10196x2] | Yes, LOAD is native. !? What's the point? |
Anton, right. Good point. | |
Anton 9-Apr-2008 [10198] | And in any case, what does "local" mean ? How would LOAD determine what is meant by local ? The block it's in does not have any associated context. |
Geomol 9-Apr-2008 [10199] | Ah, let me reconsider the native! thing. Was thinking in terms of blocks. It's an object! of course. ... |
Anton 9-Apr-2008 [10200] | Only the words in the block know what context they're bound to. |
older newer | first last |