On 15 Apr 2013, at 16:48, Mark Morgan Lloyd wrote: > I was having a bit of fun earlier while waiting for a call. Am I correct in > believing that something like > > type t1= array of integer; > > var a1: t1; > x: integer; > > a1 := [1,2,3,4,5]; > > can't be done at present, irrespective of any custom definition of the := > operator?
Maybe if you overload the assignment operator for "t2=set of byte" to "t1" assignments, but I'm not certain. It's definitely not something we explicitly support. > Is there an accessible not-a-number constant, to allow me to do something like > > var reduce: double= NAN; > > x := reduce + a1; > > with an appropriate definition of the + operator without risk that an error > would try to evaluate it as an ordinary arithmetic expression? We don't have constant to identify a qNaN. I don't even know whether all architectures support them. Currently, the only way to achieve the above is by masking exceptions for invalid floating point operations: math.SetExceptionMask(math.GetExceptionMask + [exInvalidOp]). You cannot overload/override operators that have a built-in meaning in the language (such as double+double). Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal