comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Discriminants of tagged types
Date: Sun, 31 Oct 2010 14:06:55 -0700 (PDT)
Date: 2010-10-31T14:06:55-07:00	[thread overview]
Message-ID: <bbd67bb7-5e86-4ca6-aab8-5e604b7f5920@r14g2000yqa.googlegroups.com> (raw)
In-Reply-To: 4b0e9629-5a2b-446f-a1bc-d3432db74f13@d8g2000yqf.googlegroups.com

On 31 Paź, 19:36, Shark8 <onewingedsh...@gmail.com> wrote:

> I got one for you; I was using tagged types to implement the typing-
> system for a PostScript interpreter.

Yes, this is a good example.
But then - do we consider assignment to be part of the "copyability"
property?
That is, it might be meaningful for your objects to be cloned
(duplicated), but is it also meaningful for them to be assigned to one
another?
Is the assignment meaningful only within the same type, or across the
hierarchy as well?

The reason for the above question is that even though at the language
level copy initialization and assignment are somewhat mixed together
by the type being either limited or not, they are in fact distinct
concepts and not that much similar.

In the tutorial analogy of famous shapes, it might be perfectly
reasonable to duplicate an arbitrary Shape'Class (whatever it is), but
it will be completely unreasonable to assign Square to some existing
Circle. This problem alone would be sufficient for me to make
everything limited.
Similarly with the interpreter objects, states in FSMs, and so on.

Thus, for the purpose of modeling clarity I prefer to distinguish
between:
- copyability, which means support for copy-initialization *and*
assignment
- cloneability, which is always deep

So - even though my tagged types are typically limited, in some
particular cases they can be also cloneable. It does not apply to
files, sockets, database connections and similar things that are
associated with some resources that exist outside of the physical
representation of the object, but it might apply to self-contained
data entities like interpreter instructions, document elements, states
in FSMs, etc.

I hope that the above clarification makes my rule of thumb more
understandable and not really conflicting with your examples.

--
Maciej Sobczak * http://www.inspirel.com



  reply	other threads:[~2010-10-31 21:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 12:16 Discriminants of tagged types Maciej Sobczak
2010-10-27 12:34 ` Ludovic Brenta
2010-10-27 13:19   ` Dmitry A. Kazakov
2010-10-27 13:52     ` Robert A Duff
2010-10-27 14:12       ` Dmitry A. Kazakov
2010-10-27 13:44 ` Robert A Duff
2010-10-27 15:06   ` Adam Beneschan
2010-10-27 15:58     ` Yannick Duchêne (Hibou57)
2010-10-27 16:35       ` Vinzent Hoefler
2010-10-27 17:58       ` J-P. Rosen
2010-10-27 20:18         ` Yannick Duchêne (Hibou57)
2010-10-27 20:26       ` Adam Beneschan
2010-10-27 22:07         ` Yannick Duchêne (Hibou57)
2010-10-27 22:42           ` Adam Beneschan
2010-10-27 15:13   ` Maciej Sobczak
2010-10-27 16:02     ` Yannick Duchêne (Hibou57)
2010-10-27 21:13       ` Maciej Sobczak
2010-10-27 21:23         ` Ludovic Brenta
2010-10-28  8:38           ` Maciej Sobczak
2010-10-27 21:25         ` Vinzent Hoefler
2010-10-28  7:53         ` Dmitry A. Kazakov
2010-10-28  8:50           ` Maciej Sobczak
2010-10-28 10:28             ` Dmitry A. Kazakov
2010-10-28 17:48             ` Yannick Duchêne (Hibou57)
2010-10-29 18:59             ` Vinzent Hoefler
2010-10-30 21:05               ` Maciej Sobczak
2010-10-30 21:21                 ` Vinzent Hoefler
2010-10-30 22:01                   ` Yannick Duchêne (Hibou57)
2010-10-31 16:20                   ` Maciej Sobczak
2010-10-31 17:04                     ` Yannick Duchêne (Hibou57)
2010-10-31 18:36                     ` Shark8
2010-10-31 21:06                       ` Maciej Sobczak [this message]
2010-11-01  0:44                         ` Shark8
2010-11-01  9:41                           ` Maciej Sobczak
2010-10-27 16:06     ` Robert A Duff
2010-10-27 16:34       ` Yannick Duchêne (Hibou57)
2010-10-27 21:05       ` Maciej Sobczak
2010-10-28  0:35         ` Robert A Duff
2010-10-28  8:55           ` Maciej Sobczak
2010-10-27 21:28       ` Simon Wright
2010-10-27 13:54 ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox