World: r3wp
[Core] Discuss core issues
older newer | first last |
Pekr 26-Jun-2006 [4935x2] | I would prefer 29-Feb-2006 error, as well as e.g. error? try [load 380.250.250] being a bit more relaxed in interpreter ... |
how can I catch such syntax errors? | |
Graham 26-Jun-2006 [4937] | what is your problem? |
Ladislav 26-Jun-2006 [4938] | error? try [load "29-Feb-2006"] ; == true |
Pekr 26-Jun-2006 [4939x4] | the problems is uncatchable error |
I am not talking about string .... | |
I am not sure I can meet with such situation in real-life :-) I just got asked by Bobik. The thing was, that in sqlite date field there can be invalid date. Now I am not sure how is the conversion done, if via string, but if you simply type such invalid date in console, it can't be recovered, and that is my objection in general ... | |
shouldn't we be always able to recover from whatever error happens? | |
DideC 26-Jun-2006 [4943] | To be executed, a script is loaded in a whole. So each values is loaded/binded and your error appears at this time, not while the expression is evaluated. |
Pekr 26-Jun-2006 [4944] | do you mean that I can catch the error during load? but why loading value itself fails? |
Graham 26-Jun-2006 [4945] | what uncatchable error? |
Pekr 26-Jun-2006 [4946x2] | try to type in console 29-feb-2006 .... |
although it is invalid, I thought that by error? try [29-Feb-2006] I will be able to recover eventually, which is not the case ... | |
Graham 26-Jun-2006 [4948x4] | >> if error? try [ load form 29-feb-2006 ][print "date format error" ] ** Syntax Error: Invalid date -- 29-feb-2006 ** Near: (line 1) if error? try [ load form 29-feb-2006 ][print "date format error" ] >> |
>> if error? try [ load "29-feb-2006" ][print "date format error" ] date format error >> | |
Doesn't like the 29-Feb-2006 as a date string | |
date type! | |
Henrik 26-Jun-2006 [4952] | looks like a bug? |
Graham 26-Jun-2006 [4953] | Looks like it. |
Volker 26-Jun-2006 [4954x2] | Does not like 32-may-2006 too. Isn't this more a feature than a bug? |
error? try [29-Feb-2006] is "word! word! [what-is-this?]". Reol has no idea what to do with "error?" at that time. | |
Pekr 26-Jun-2006 [4956x2] | well, but Volker, anyway, we got to state, where we have non-recoverable interpreter state, don't we? |
I know the date is invalid, but .... the same goes for tupple, e.g. 380.250.250 | |
Volker 26-Jun-2006 [4958x2] | >> 380.250.250 ** Syntax Error: Invalid tuple -- 380.250.250 ** Near: (line 1) 380.250.250 |
you are not at interpreter state at that time. think of 'load finding an error at compile-time. | |
Pekr 26-Jun-2006 [4960] | I know, I just don't like the fact, console is not safe from such errors .. |
Volker 26-Jun-2006 [4961x2] | Thats why ladislav puts the date in a string. compiled later. |
how should it work instead? | |
Pekr 26-Jun-2006 [4963x3] | ok, can we meet with state, where your app returns directly such invalid date? e.g. mentioned link to sqlite date field? |
how would it work? dunno? a bit more relaxed evaluation? interpreter finding string 29-Feb-2006 - it is valid format, not just valid value. Under some condition it could be even valid date (leap year). I would expect even such error to be catchable ... | |
ok, so I will have to trust gurus the fact, that technically it can't be fixed :-) | |
Henrik 26-Jun-2006 [4966] | how does Rebol not know how to handle 29-feb-2006 as a date! ? I'm not sure I understand this, because how then is the unrecoverable error generated? from what I see, you'll always need to wrap some precautionary measures around handling dates to avoid this. that's not good design. |
Volker 26-Jun-2006 [4967] | internal its not a string, but a number. you would get 29-feb-2006 as 1-mar-2006. would that be ok? |
Pekr 26-Jun-2006 [4968] | anyway ... I don't like current state, that is all. I even don't know consequences, just a feeling :-) Maybe Carl could give us his opinion, if it is bug or not, and if not, if this is desirable behavior ... |
Volker 26-Jun-2006 [4969] | maybe a hook in 'load, whcih can do some spellchecking? |
Pekr 26-Jun-2006 [4970] | hmm, help me to imagine, how does interpreter internally works? So let's simplify it - it reaches 280.250.250 tuple. It tries to parse it. It eventually recognises it as a tupple, otherwise it would not return "Invalid tuple", no? But then it finds invalid values ... why just doesn't it recognise, it is part of 'try block and does not throw error, which would be catchable? |
Volker 26-Jun-2006 [4971x4] | because it does not try to parse it. it has already. |
'load does the parsing. after load has finished, all datatypes are in an optimized form. | |
if load cant handle something, it is helpless. it does not know something is inside a try-block. it only knows it has loaded a lot of words already and the followingtext is not right. | |
that means the error happens when the sourcecode with the try is laoded, before try as any achance to be executed. | |
Pekr 26-Jun-2006 [4975] | then maybe there could be two phases of load .... parse form, not the value first :-) 999.999.999 for a valid tuple! datatype. It is too strict, in opposite to: >> email? to-email "nonsense" == true |
Henrik 26-Jun-2006 [4976] | that's why we have the term "loadable", right? Carl talks about this when parsing. Otherwise this wouldn't be a problem. |
Volker 26-Jun-2006 [4977x3] | maybe some datatype "weird" with the original string and a type-suggestion? but then you get problems with ambiguities. |
what is a typo, what ignored? 6-pfu-206 ? | |
maybe i amn to conservative, used to compilers which tell me each bug, instead of fixin it. always fearing a misunderstanding when the compiler would try toguess itself. if it could reliable guess, thatwould be cool :) | |
Henrik 26-Jun-2006 [4980] | as long as there are no dead ends with truly unrecoverable errors... |
Pekr 26-Jun-2006 [4981x2] | Volker - but how does it know of 29-Feb-2006? Under some condition, it is valid date ... imo already higher level logic is applied here, no? |
- btw - from my pov, regard this discussion academic .... I don't understand compilers, interpreters, just speculating here :-) | |
Graham 26-Jun-2006 [4983x2] | quick question ... I have a number of simple objects that I create on the web server and then send back to client in molded format. |
how does one restore them back to objects? | |
older newer | first last |