[nem-en] Operator ??

Kamil Skalski kamil.skalski at gmail.com
Sat Oct 28 14:00:21 CEST 2006


I think a much more useful macro is

  macro nullcheck (expr, deflt = <[ null ]>) {
    match (expr) {
      | <[ $obj . $_n ]> =>
        <[ if ($obj != null) $expr else $deflt ]>
      | _ => expr
    }
  }

;)

On 10/2/06, Igor Tkachev <it at rsdn.ru> wrote:
> Hello Ivan,
>
> > Hmm, I'm not sure will ??= operator usefull,
>
> I'm sure you are not :))
>
> For example, property lazy initialization with non default value.
>
> > but it's quite simple to implement when we have ?? operator:
>
> >   macro @??= (exprA, exprB)
> >   {
> >     <[ {$exprA = $exprA ?? $exprB; $exprA} ]>
> >   }
>
> > Let's JIT removes unnecessary assignment: a = a
>
> Now I'm not sure it will.
>
> --
> Best regards,
>  Igor                            mailto:it at rsdn.ru
>
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


-- 
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list