World: r3wp
[Core] Discuss core issues
older newer | first last |
[unknown: 5] 4-Apr-2008 [10127x6] | However, would anyone use them? Or would they just code as needed if they are going to use the /base product anyway? |
Just some things to think about. | |
Kind of a niffty way to hide some code that I have been playing around with lately but it isn't full proof: | |
a: [] append a use [b][b: context [c: "Cool"] does [b/c]] d: first a | |
>> d == "Cool" | |
>> source d d: func [][b/c] | |
Anton 4-Apr-2008 [10133] | Essentially: d: does bind [print c] context [c: "Cool"] |
[unknown: 5] 4-Apr-2008 [10134] | Yep. |
Anton 4-Apr-2008 [10135x2] | >> d Cool >> source d d: func [][print c] |
But, like your version, if we can get the word, we can get its context: >> probe do bind [self] second second :d make object! [ c: "Cool" ] | |
[unknown: 5] 4-Apr-2008 [10137] | yep it can never be full proof in R2 as far as I know. |
Anton 4-Apr-2008 [10138] | fool proof |
[unknown: 5] 4-Apr-2008 [10139] | ahhh wasn't sure, lol |
Anton 4-Apr-2008 [10140] | actually "foolproof" |
[unknown: 5] 4-Apr-2008 [10141] | maybe fool-proof? |
Anton 4-Apr-2008 [10142] | full proof pertains to strength of alcohol. |
[unknown: 5] 4-Apr-2008 [10143] | indeed |
Anton 4-Apr-2008 [10144] | Well... we can unset 'self, so that the above method does not work: >> do bind [unset 'self] second second :d >> probe do bind [self] second second :d ** Script Error: self has no value ** Near: self |
[unknown: 5] 4-Apr-2008 [10145] | does that hide it completely? |
Anton 4-Apr-2008 [10146x2] | I haven't tested that much at all, so I don't know if that would break anything as rebol goes along... |
I'm not sure if there is another way in, quite possibly there is. | |
[unknown: 5] 4-Apr-2008 [10148x3] | Even if it does it might be useful in controlled situations. |
I know you can hide some things by simply declaring an object and afterwards setting the objects self to a different value | |
>> a/self: 3 == 3 >> a >> probe a make object! [ b: 2 ] >> a/self == 3 | |
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 [10176] | it won't pass my parse rule |
older newer | first last |