What do you want your original example to do?

> On Oct 21, 2014, at 3:39 PM, Till Ehrengruber <[email protected]> wrote:
> 
> ah i see. I'm a bit confused about conditionals since
> 
> false || nothing
> 
> for example works alright but
> 
> nothing || false
> 
> does not. Since the last one doesn't work like I expected my question is 
> pretty senseless ^^ But still i like the used syntax as this doesn't need 
> another function (like the `ismatch`) which can be pretty nasty to implement 
> when the computation is havy and you want to cache the result. Is there any 
> specific reason that conditionals aren't "symmetric"?
> 
> Can't see the benefit of the nullable type in this case can you tell?
> 
> Am Dienstag, 21. Oktober 2014 14:39:12 UTC+2 schrieb Jacob Quinn:
>> 
>> Not sure what you’re asking here: do you have a case where you can’t use a 
>> return within an expression? One thing to note with your example above is 
>> that only boolean values can be used in conditionals (i.e. if-statements, && 
>> and || operators, etc.), match returns the match contents if there was a 
>> match, and the nothing value otherwise. So to make your case work, you’d 
>> need something like:
>> 
>> captures = ismatch(regex,str) ? match(regex, str).captures : return
>> In Julia 0.4 dev branch, a Nullable type was recently merged and it’s been 
>> discussed using a Nullable as the return type of regex operations which 
>> would make it slightly easier to check for non-matches.
>> 
>> -Jacob
>> 
>> ​
>> 
>>> On Tue, Oct 21, 2014 at 3:52 AM, Till Ehrengruber <[email protected]> 
>>> wrote:
>>> wouldn't it be nice to be able to use the return statement deep inside your 
>>> expression such that something like
>>> 
>>> captures = (match(regex, str) || return).captures
>>> 
>>> in this specific case i encountered a simple HttpRouter which just skips 
>>> the current handler and i don't really need the other results of the match 
>>> expression
>>> 
>>> regards till
>> 

Reply via email to