[Gambas-devel] About gb.gsl components

Emil Lenngren emil.lenngren at ...176...
Sun Jul 8 18:01:36 CEST 2012


Hi. Some null checks seems to be required. For example:

Dim A As Complex = NULL
Print Abs(A)

-> Segmentation fault

Another question: If I have a class I want to implement _operators in, do I
have to implement all 13 or can I set some of them to NULL?

/Emil

2012/7/8 Benoît Minisini <gambas at ...1...>

> Hi Randall,
>
> I have no news from you for a long time. I hope everything is ok for you!
>
> Since revision #4908, the interpreter allows any native class to handle
> the standard arithmetic operators - at least some of them at the moment:
> +, -, *, /, =, <>, and Abs(). This is done through the "_operators"
> interface.
>
> Moreover, the "_convert" interface now allows to convert any native
> object to any other datatype, and is called by Str() and Print to
> convert an object to a localized string representation.
>
> I used that in the Complex class, so that you can do:
>
>         Dim A As New Complex(1, 4)
>         Dim B As New Complex(3, -1)
>
>         Print A;; B;; A * 2;; A * B;; A / B
>
>         --> 1+4i 3-i 2+8i 7+11i -0,1+1,3i
>
> I have ',' inside numbers because this the french decimal separator.
>
> Tell me if you want to continue working on gb.gsl. That new feature
> could be implemented in polynomials, matrix... with automatic
> conversions between them maybe!
>
> Regards,
>
> --
> Benoît Minisini
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20120708/6ed57b97/attachment.html>


More information about the Devel mailing list