World: r3wp
[!REBOL3]
older newer | first last |
Paul 3-Mar-2010 [1164x2] | I think we need a way to pass that block so that 'a and 'b can evaluate to none |
It is clear why it setting a and b to 1 but we need to have something a bit safer. | |
BrianH 3-Mar-2010 [1166x2] | We want that behavior and much code depends on it. You can add the none explicitly if you need that value. |
And CONSTRUCT doesn't evaluate anything, so safety is not an issue. | |
Paul 3-Mar-2010 [1168x2] | Still we need to check it and we could simply have another switch that could fix construct to be even more superior. |
construct/as-is | |
BrianH 3-Mar-2010 [1170] | We have that option, except it's called /only. |
Paul 3-Mar-2010 [1171x2] | that doesn't work for this issue |
>> a: construct/only [c: d: 1] == make object! [ c: 1 d: 1 ] | |
BrianH 3-Mar-2010 [1173] | Chained assignments aren't an issue, they are an intended feature. |
Paul 3-Mar-2010 [1174] | I understand that but we need a feature in which they are NOT. |
BrianH 3-Mar-2010 [1175] | >> construct/only [a: b:] == make object! [ a: none b: none ] |
Paul 3-Mar-2010 [1176] | that is still a chained assignment |
BrianH 3-Mar-2010 [1177] | But that's not a problem. |
Paul 3-Mar-2010 [1178x4] | Ok, it doesn't seem your following me, so let's forget about construct. |
We need a function that does not evaluate or do chain assignment. | |
But let's you access the elements as if they are an object and can already exist in a block style spec that can be passed to context. | |
So it would be similiar to construct except without the chain assignment. | |
BrianH 3-Mar-2010 [1182] | CONTEXT does chained assignment too, btw. |
Paul 3-Mar-2010 [1183] | Yes, so does almost everything in REBOL since day 1. Surely your not thinking I just stumbled upon that discovery. |
BrianH 3-Mar-2010 [1184] | Do you need to access the elements as if they are in an object, or elements that are actually in an object? |
Paul 3-Mar-2010 [1185] | I'm just seeing room for improvement here to make REBOL even more safe. |
BrianH 3-Mar-2010 [1186] | But there are no safety issues with chained assignment. |
Paul 3-Mar-2010 [1187x5] | I could simply just use a block if I want to access elements but that isn't ideal for conversion to an object when I decide I want that flexibility. |
Not so my friend. | |
That is where your wrong. | |
Ideally you would use a construct for assignments of values passed via cgi. | |
While those items are string values it could still potentially be exploited in my opinion. | |
BrianH 3-Mar-2010 [1192] | It sounds like you need a PARSE wrapper. |
Paul 3-Mar-2010 [1193x2] | Or we just make sure that such assignment is not chained - ;-) |
bbl | |
BrianH 3-Mar-2010 [1195x4] | If the CGI data is parsed properly it should never generate anything other than pairs. If it ever generates chained assignments that is an error in your parse rules, not CONSTRUCT. |
By "pairs" I mean name-value pairs, not pair! values. | |
On the other hand, you can APPEND to objects and maps in R3, so you don't need the block at all. | |
And appending to objects doesn't chain assignments. | |
Paul 3-Mar-2010 [1199x3] | I'll create my own function. |
problem solved. | |
is this really a valid email? >> email? load "carl@.com" == true | |
BrianH 3-Mar-2010 [1202] | It doesn't check whether the email address is valid, just that the syntax is valid. |
Paul 3-Mar-2010 [1203] | I could suppose that syntax is valid if I worked my ISP was a root server. |
Gregg 4-Mar-2010 [1204] | Paul, creating your own func is the way to go for that. And emails can be very complex. REBOL doesn't try to validate against the true grammar, it just looks for @. |
Steeve 4-Mar-2010 [1205] | actually the smallest valid email in Rebol is 1 char + @ >> type? 1@ == email! |
Gregg 4-Mar-2010 [1206] | :-) |
Sunanda 4-Mar-2010 [1207] | cc#1509 -- Thanks Brian for consolidating a whole handful of bug reports [and/or misunderstandings]. That should help focus the core RT crew into clarifying / fixing. |
Cyphre 4-Mar-2010 [1208] | Paul, I usually test email entry using simmilar code to this: if any [ not email? try [email: first load/next cgi/email] all [ not read join dns:// email/host not read rejoin [dns:// "smtp." email/host] not read rejoin [dns:// "pop." email/host] not read rejoin [dns:// "mail." email/host] not read rejoin [dns:// "www." email/host] ... ] ][ print "email is not valid or your email server is unavailable" ] Worked well in most cases for me but I bet others might have more sophisticated solutions. |
BrianH 4-Mar-2010 [1209] | Thanks, Sunanda, never would have figured it out without your help. |
Gabriele 4-Mar-2010 [1210] | Sunanda, you're still seeing this the wrong way. ATTEMPT never returns an error. the "error" you are talking about happens outside of ATTEMPT, so it can't guard against it. |
Andreas 4-Mar-2010 [1211x3] | Yes, Gabriele, that's how things are currently implemented. |
The question is, should the error occur inside the attempt instead? | |
I think that RETURN, EXIT and BREAK, CONTINUE should be only available in their respective contexts (functions, and loops). CATCH/THROW will need special treatment. QUIT, Q, HALT can be left as is. | |
older newer | first last |