[M3devel] quake and/or "short circuit"

Olaf Wagner wagner at elegosoft.com
Mon Aug 16 09:55:04 CEST 2010


You talk about `conditional and' and `conditional or'... I thought we had
that in quake like in M3, but I might be mistaken.

It should not be difficult to implement that though.

Using it will be difficult until we've had a release which contains it...

Olaf

Quoting Jay K <jay.krell at cornell.edu>:

> It would have been nice for and/or to short circuit in quake like   
> they do in C.
>
>
> Code like:
>
> if not defined("TARGET")
>   readonly TARGET = "I386_FREEBSD"
> else
>   if not equal(TARGET, "FreeBSD4")
>     readonly TARGET = "I386_FREEBSD"
>   end
> end
>
>
> is better written as:
> if not defined("TARGET") or not equal(TARGET, "FreeBSD4")
>   readonly TARGET = "I386_FREEBSD"
> end
>
> but that isn't allowed because equal() will complain that TARGET   
> isn't defined.
>
> It probably can't fixed though, due to e.g.:
>
> if TRUE or DoSomething()
>   ...
> end
>
>
> would be broken.
>
>
> perhaps
> OR and AND
> or short_circuit_and
> or and_shorted
> or and_short_circuit
> or and_early_out
> or and_early
> or "&&"
> or something...
>
>
> Or I should just rewrite so much quake in Modula-3...
>
>
>  - Jay
>



-- 
Olaf Wagner -- elego Software Solutions GmbH
                Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23 45 86 96  mobile: +49 177 2345 869  fax: +49 30 23 45 86 95
    http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194




More information about the M3devel mailing list