World: r3wp
[All] except covered in other channels
older newer | first last |
BrianH 9-Jan-2009 [3321] | oif -> of |
Steeve 9-Jan-2009 [3322] | i talking about the functionnalities not about his implementation |
BrianH 9-Jan-2009 [3323] | So am I. That functionality won't work, for reasons Doc most recently explained. |
Steeve 9-Jan-2009 [3324x2] | we just need a list of separators when a wrong loadable value is encountered to continue the loading |
reasons Doc exposed are false | |
BrianH 9-Jan-2009 [3326] | We have a list of separators: Whitespace. Anything else requires special handling that will need to be specified. The only problem with Doc's comment is not getting that part of the LOAD/else proposal. |
Steeve 9-Jan-2009 [3327] | anyway if your objective is to build a mezzanine it's useless, it will be slow, i will continue with my own pre-parsing process |
BrianH 9-Jan-2009 [3328x2] | LOAD is a mezzanine, but it calls natives. My goal is to make LOAD useful. |
Please contine to do your preparsing. I was doing this on btiffin's suggestion, and he seems to be afraid of PARSE :) | |
btiffin 9-Jan-2009 [3330] | Umm, yes and no on the fear. Yes fear kept me from holding a lecture on the subject, but I usually PARSE from reading the pretty print code. That's how my locate utility works. But I'm not concerned with us. I'm concerned with construction bosses and non-tech professors having access to a programming language and learning maybe one or two tricks a week. I'm also on the side of the gurus in terms of correctness and concise coding, but I'd like to see REBOL ,the system, that out of the box would be a robust battle tank. Add taint to the fuel, it would still function; perhaps not gracefully, but the big guns would still fire. Today, the slighest spoonful of sugar and our tank dies on the field, no movement, no guns. foreign! and Steeve's suggestion of scan till whitespace (and yes, some source code would load as almost all completely foreign! gibberish if a quote was out of place, but so, we can take that and fix it). But at least REBOL wouldn't die; the data/code would be loaded and inspectable. And yes, this could lead to the odd rare catastrophic failure, but we get that potential with "clean" datatype! scripts too. I think the slight increased risk is worth the new group of users this could attract. |
BrianH 9-Jan-2009 [3331] | Sorry if I misrepresented your position Brian, I was trying to be humorous. I've just put in a request to tweak TRANSCODE's handling of commas. If that request goes through, I will be able to add the /else option to LOAD. With a few more tweaks I can increase the speed, make more of the process native, etc. This is not preventing REBOL from dying - it is just allowing you to provide a defibrillator :) |
[unknown: 5] 9-Jan-2009 [3332x2] | In case you wondered about the origin of CTRL-ALT-DELETE - this is actually kinda funny http://www.flixxy.com/computer-history-ctrl-alt-del.htm |
There will be everywhere soon - the revolution of the TIRE http://www.flixxy.com/car-tire-technology.htm | |
btiffin 9-Jan-2009 [3334] | Oh Brian. I take few thingsseriously ... well, except my belief systems. ;) Me too, I forgot the smiley after ... pretty print code. And Yayy. Now if this can be out-of-the-box REBOL for linguistic profs and science types ... woohoo! |
Pekr 9-Jan-2009 [3335] | btiffin - did you read R3 'transcode description? It seems to have relaxed execution, returning error as an arror. Not sure it would be what you want, but maybe? http://www.rebol.net/wiki/Transcode |
BrianH 9-Jan-2009 [3336x4] | Actually, that is exactly what we need. One problem though: >> transcode "a," == [make error! [ code: 200 type: 'Syntax id: 'invalid arg1: "word" arg2: "a," arg3: none near: "(line 1) a," where: [transcode] ] ""] I've requested that this be changed to: >> transcode "a ," == [a ","] putting off the error until the next call. That change would be enough to do LOAD/else. |
All it would require is to make "," a delimiter in the scanner - a trivial change for Carl. | |
Sorry, two messages back: "a ," -> "a," | |
in the second example. | |
btiffin 10-Jan-2009 [3340] | Pekr; I think a convo we had on the blog wayy back was partly why Carl relaxed TRANSCODE ;) We went through a phase of trying to name the junk! datatype, and very real issues were raised about where the lexical scan should restart after. Then someone discussed the linguistic analytic potential and another very real concern about polluting the semantics of REBOL datatypes was raised. Carl may have been afraid we'd all run off and produce "any old crap that works", where I aim to provide a console that takes "any old crap" and works. ;) Leaving Gabriele and others free to use the ever cool true semantic meaning of data and code and leave junk! that floats for analysis of real world information sans REBOLification. Part of that conversation lead to and is included in http://www.rebol.net/cgi-bin/r3blog.r?view=0078#comments |
Pekr 10-Jan-2009 [3341] | BrianH: ... then I expect you will propose the change to Carl, to enable load/else? :-) |
Gabriele 10-Jan-2009 [3342] | any known rebol datatype should be recognised, and the rest should be assigned under junk! or similiarly named datatype. What is AI about that? Telling the different between a REBOL value and "the rest" is AI. If you can without AI, then "the rest" is defined with a specific parse rule... then you can just use string parsing, and it's not a human language anymore but a specific language you just designed. |
Dockimbel 10-Jan-2009 [3343] | Right, I misunderstood LOAD/else proposal, I thought you could supply your own parsing rules to be used from the point where LOAD fails. But I still can't see the point of using LOAD on non-REBOL data, instead of string parsing or LOAD/next. LOADing a whole book would most probably blow out REBOL words limit. If it all boils down to splitting untrusted input into whitespace separated tokens, why no just use PARSE data "" ? Is there a real benefit for the programmer of having LOAD not stop on syntax errors? |
btiffin 10-Jan-2009 [3344] | Doc; no not really a benefit to programmers and rebol-by-nature types; The goal is non-rebol types and creating ease of use that attracts those types to become rebol-by-nature. But I've sure wasted a lot of good rebol time already, so ... Go Doc Go and Do Gabriele Do Ok ... and Yay Brian! ;) |
BrianH 10-Jan-2009 [3345] | Pekr, I have already proposed the TRANSCODE change, and I can start the implementation of LOAD/else asap (which will likely be after the release). LOAD/else will work without the TRANSCODE fix, but will work better with the fix. |
Henrik 28-Mar-2009 [3346] | About VPS: Looks like it could be Linode for me. Slicehost is pretty on the surface, but it appears that customers are a bit happier with Linode. Also Slicehost was recently purchased by Rackspace, and some customers reported a lower service quality after that. That might be a bad sign. |
Maxim 28-Mar-2009 [3347x2] | doc, its faster to let rebol do what is does best in binary and let us take over on those tokens it can't recognise. just ignoring comma would have allowed me use scientific data more than once directly without having to dare understand parse intricacies. remember that parse IS NOT EASY. I didn't use it for over 6 years, cause everytime I dared, it just blew up in my face. this would provide a simple entry point for more people to support DSL and leverage the rich datatype system in rebol, without the need to be a guru level reboler. |
the point is not to replace REBOL's syntax, but allow REBOL to cope better with the rest of the world's data, IMHO. | |
Dockimbel 28-Mar-2009 [3349] | IMO, designing a good DSL is far more difficult than writing parse rules. I think that ppl here are underestimating the complexity of implementing a jump-over-foreign-data feature that would work in the general case. REBOL syntax is not based only on whitespaces, but on delimiters too : double-quotes, curly and square brackets, parenthesis,.... So it's perfectly valid to not use whitespaces at some places, like in : "either conditon [true][false]". So what should LOAD do in case of, e.g. : "either condition [f,o,r,e,i,g,n,0,1][false]" ? IMHO, besides reporting a syntax error at "f," , there's no much point returning [either condition "[f,o,r,e,i,g,n,0,1][false]"]. And if you think that LOAD could just return [either condition ["f,o,r,e,i,g,n,0,1"][false]], then you just jumped over the complexity by creating some syntax rules in your mind, but LOAD can't do that. Once LOAD has passed the syntax error point, it has no sure way to determine where the foreign data ends and where REBOL correct syntax starts again. That would require at least, an AI engine (like Gabriele stated above). I'm not even sure that all possible cases could be covered that way. Btw, does such feature exists in any other programming language? I've personally never seen or read about such feature elsewhere, maybe for a good reason. |
Steeve 28-Mar-2009 [3350] | load-foreign works well to me in R3. alpha: charset [#"a" - #"z" #"A" - #"Z"] chars: union alpha charset [#"0" - #"9" "-_"] word: [alpha any chars] probe load-foreign "either condition [f,o,r,e,i,g,n,0,1][false;]" [ ;**keep words with comma as trings [word some [#"," any chars]] [keep &] ;**remove ";" at the end of words [word #";"] [keep to-word head remove back tail &] ] >> [either condition ["f,o,r,e,i,g,n,0,1"] [false]] |
btiffin 28-Mar-2009 [3351x2] | I still vote for foreign! as a datatype. Sure there will still be reasons for throwing errors on evaluation on foreign! but I don't like the fact that the errors occur on load. Give linguists a tool that out-of-the-box can load a poem and let them count characters, words, and transitions. Let REBOL pros worry about the hassles of evaluation. Re: where the foreign data ends; Skip AI, just go with delimiters. Whitespace or quotes or any of the braces etc. And if a missing quote causes a script to fail ... well bad on the coder for not testing before release. If the English professor gets wonky counts, well let them figure it out, but give them the wonky counts not a LOAD failure. IMHO it really would open the door to so many more uses and users. And with Steeve's example ... build something like that into the product. Don't make poor Professor Keating try and figure out why most of the Dead Poet's prose can't be analysed with REBOL's nifty cool block data functions. And as long as REBOL had foreign! as a native datatype, writing a LINT would be dirt easy. |
And I could LOAD %cobol.cob and do all kinds of super cool preprocessing. Or at least wait for Sunanda to write a super cool preprocessor and live vicariously through rebol of the year candidates. ;) REBOL could be the JavaDoc, EpyDoc, Doxygen, ..., ReST besting documentation super tool of tomorrow. | |
Maxim 29-Mar-2009 [3353x2] | doc, the point is that I and others HAVE had ,many situations where this would have saved HOURS even given new reasons to use rebol at some jobs. the point is not to allow new rebol dialects, its just that in MANY cases it would work.. we all know that this isn't a replacement for parse. but allowing me to import external data through load is just faster than parsing. You still have to tailor the extension to the dataset anyways. |
We could load things like C code directly, and then parse it using block dialecting instead. way faster. | |
btiffin 29-Mar-2009 [3355] | Ditto Maxim. Adding ... I don't look at this as being a overly good thing for rebols (although I do think we'd all benefit, save time and write a whole new breed of utilities), I think of it as a good thing for non-rebols (and us rebols with smaller brains and bigger laze). |
Pekr 29-Mar-2009 [3356] | ah, so we are at it once again .... |
Gabriele 29-Mar-2009 [3357x3] | You guys write it, then we can talk about it. |
it's incredible you think that "parse is not easy" and then you don't trust people telling you that what you ask for is silly at best. | |
parse *IS* easy. try to use regexps instead! | |
Steeve 29-Mar-2009 [3360x3] | ok i give you load-foreign, don't kick me Gabriele :-) |
context [ stack: make block! 10 foreign-rules: make block! 10 out: end: value: pos: none push: func [type][ stack: change/only stack out out: make type 1 ] pop: to-paren [ stack: back stack out: append/only stack/1 out ] set-&: [end: (misc/&: to string! copy/part pos end)] misc: context [ &: none keep: func [&][append out &] ] blanks: charset " ^-^M" rules: [ some [blanks | #"^/" (new-line out true)] | pos: foreign-rules | [#"]" | #")"] (print "missing [ or (" return stack/1) | #"[" (push block!) any [#"]" pop break | rules] | #"(" (push paren!) any [#")" pop break | rules] | (set [value pos] transcode/next/error pos append out value) :pos ] set 'load-foreign func [ text [string!] foreign [block!] ][ out: make block! 10 stack: change/only clear head stack out clear foreign-rules foreach [rule code] foreign [ append foreign-rules compose [(rule) set-& (to-paren bind code misc) |] ] append foreign-rules [end skip] parse/all to-binary text [any rules] bind out 'system either 1 = length? out [first out][out] ] ] | |
] | |
Dockimbel 29-Mar-2009 [3363] | Steeve, you're just proving my and Gabriele's point. There's no way to implement a LOAD-FOREIGN that would work for any data. You have to provide parsing rules that are specific for the input data. Max and others are asking for a LOAD-FOREIGN that just works on any input data without providing any additionnal rules. |
Ammon 29-Mar-2009 [3364] | and if you have to provide the additional rules you might as well parse it from scratch. |
Steeve 29-Mar-2009 [3365x5] | i can generate strings by default each time there are errors by default, so that there is no need to provide rules. It's a tiny modification |
But strings are not good types for those it would be better to simply add errors as objects in the loaded stream. But after that you steel need to reparse the block to convert the errors in proper values. SO, in the end, y | |
*steal | |
Ok, in the following version (much simpler) i just add foreign data as error objects in the stream. Then you can reparse the result to manage errors as you want. context [ stack: make block! 10 out: value: pos: none push: func [type][ stack: change/only stack out out: make type 1 ] pop: to-paren [ stack: back stack out: append/only stack/1 out ] blanks: charset " ^-^M" rules: [ some [blanks | #"^/" (new-line out true)] | [#"]" | #")"] (print "missing [ or (" return stack/1) | #"[" (push block!) any [#"]" pop break | rules] | #"(" (push paren!) any [#")" pop break | rules] | pos: (set [value pos] transcode/next/error pos append out value) :pos ] set 'load-foreign func [ text [string!] ][ out: make block! 10 stack: change/only clear head stack out parse/all to-binary text [any rules] bind out 'system either 1 = length? out [first out][out] ] ] | |
probe load-foreign { either condition [ f,o,r,e,i,g,n,0,1 ][ false ] } >>[ either condition [ make error! [ code: 200 type: 'Syntax id: 'invalid arg1: "word" arg2: "f,o,r,e,i,g,n,0,1" arg3: none near: "(line 1) f,o,r,e,i,g,n,0,1" where: [transcode parse load-foreign ...] ] ] [ false ] ] | |
Dockimbel 29-Mar-2009 [3370] | >> load-foreign "either condition ]f,o,r,e,i,g,n,0,1[]false[" missing [ or ( == none Not very usefull output. Remember that we are talking here of the general case where input can be *any* data. |
older newer | first last |