[DGD] Arithmetic with objects and int/float

nikoroleva natasha.i.koroleva at gmail.com
Sat May 4 16:05:56 CEST 2019


Felix A. Croes <felix at dworkin.nl> wrote:
>
> nikoroleva <natasha.i.koroleva at gmail.com> wrote:
>
> >[...]
> > Another question has more to do with the arithmetic. With the +
> > operator implemented in the rational object type, I can do r + i where
> > r is the rational object and i is an int. Mathematically, I should
> > just as well be able to do i + r. Is it worthwhile writing code to
> > enable such an expression? How would you do it?
> >
> > I started to explore this idea using a number object type that can be
> > an int, float, castable string, or rational object. Personally and so
> > far, I don't find it worth much more than scratching a curiosity itch.
> > But I'm happy to hear your thoughts on these things.
>
> You are discovering problems which have standard solutions in
> popular programming languages.  Java has an Integer class so that
> operations like Integer + Rational can be made to work.  It also has
> an abstract Number class, which can be implemented by Integer.
>
> In LPC this has only been an option since the introduction of
> light-weight objects, which DGD provides but which are absent in other
> dialects.  And the uptake of light-weight objects by MUD programmers
> has been slow.
>
> I had planned to introduce such classes to the Cloud library, but
> due to too many projects and too many other things which are also
> important for the Cloud library (such as Strings with full Unicode
> support, a full HTTP 1.1 + TLS implementation, a HTTP 2.0
> implementation, a QUIC implementation, etc) this little project has
> languished.
>
Thanks. I'll continue with that approach after I wrap up a couple of
items remaining on my original list of what I wanted to accomplish.

As about light-weight objects, I'm up to about three dozen of them. I
have more questions about them, which I plan to ask later.

I finally got around to pulling the latest cloud-server code. A merge
conflict cropped up in both auto.c files. I try to not change the
original files because of their evolving nature, but I have made a
couple of changes. I may have made a proper mess of things. I cleared
the merge conflict but now have a new error. For what it's worth, the
error is "Array index out of range":
331   continued       /usr/System/lib/auto
I understand that's vague but it just happened and I haven't looked
through anything yet. If I get stuck, I'll post more details and ask
for help.

But the unit tests now use a distributed continuation just fine.
Whatever issue (never really knew what it was) I had before is gone
now.

Have a pleasant weekend


More information about the DGD mailing list