[Gambas-devel] About gb.gsl components

Emil Lenngren emil.lenngren at ...176...
Thu Jul 12 00:19:29 CEST 2012


OK, good.

I will be on holiday from tomorrow until the first week in August, so I
will start work when I come home.

/Emil

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

> Le 11/07/2012 22:06, Emil Lenngren a écrit :
> > Next bug:
> > Public Sub Main()
> >    Dim a As Object = New Complex(2, 1)
> >    Dim i As Integer
> >    For i = 1 To 2
> >      Print a + 2.0
> >      a = Me
> >    Next
> > End
> >
> > -> Segmentation fault.
>
> OK, fixed in revision #4944.
>
> >
> > And some questions:
> > I see that if a class inherits Complex (at least a non-native class),
> > the operators are also inherited = good.
> > When I implement this in the JIT, can I assume that child classes do not
> > override operators, i.e. can I codegen a direct call to the operator (if
> > the type is a "pure object")? Or do I have to use virtual dispatching?
> >
> > /Emil
> >
>
> At first sight, I would say that you have to use virtual dispatching, as
> nothing prevents a class to reimplement the _operators interface.
>
> But in other way, I don't find any real use of that.
>
> If A inherits B, then being a B implies being an A, so adding Bs should
> be handled by the A addition operator.
>
> But we never use inheritance for numbers: otherwise an integer would
> inherit a floating point that woul inherit a Complex that would inherit
> a Matrix, and everything would be a Matrix internally!
>
> So, even if I would not prevent reimplementing the _operators interface,
> I will never do it, and so you can assume that you can do a direct call.
>
> If there is a problem in the future, we'll see...
>
> --
> 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/20120712/e9b7b17e/attachment.html>


More information about the Devel mailing list