[comp.lang.ada] user-defined assignment

firth@sei.cmu.edu (Robert Firth) (12/09/88)

I don't want to become too embroiled in the current
debate about user-defined assignment, but one serious
misconception should, I feel, be corrected.

The ability to use ":=" as a subprogram designator
would in no way change the current strength or weakness
of Ada's typing model.  The process of overload resolution
would check actuals against formals, just as it does for,
say, "+" at present.  Naturally, a malicious implementor
could encode the body of ":=" so as to violate the typing
rules, just as an implementor of "+" can today.

dsr@hector.UUCP (David S. Rosenblum) (12/10/88)

In article <7943@aw.sei.cmu.edu> firth@sei.cmu.edu (Robert Firth) writes:
|
|I don't want to become too embroiled in the current
|debate about user-defined assignment, but one serious
|misconception should, I feel, be corrected.
|
|The ability to use ":=" as a subprogram designator
|would in no way change the current strength or weakness
|of Ada's typing model.  The process of overload resolution
|would check actuals against formals, just as it does for,
|say, "+" at present.  Naturally, a malicious implementor
|could encode the body of ":=" so as to violate the typing
|rules, just as an implementor of "+" can today.

What "typing rules" of "+" can an implementor violate within his definition
of "+"?  I didn't know that the semantics of predefined "+" had any inherent
"typing rules" to violate.  As you say, the typing rules apply to parameters
of "+" and the return value of "+", as they do to all other subprogram
parameters and return values (e.g., in a user-defined ":=").  On the other
hand, as I understand ":=" it is restricted to copying a value of some type to
a variable of the SAME type, including a check that ALL subcomponents of the
target variable satisfy their respective constraints.  Aside from the rules
regarding implicit conversions of numeric values, I'm aware of no
rule (or AI) that sanctions a weakening of the behavior of ":=" as I've
(hastily) described it.  For example, I can "add", say, tasks to strings with
my own definition of "+".  This may violate some cherished notions about
addition, but I don't see that it "violates" any typing rules.  But with
overloaded ":=", I could assign tasks to strings; to me this violates typing
rules, as they currently apply to assignment.


-------------------------------------------------------------------
David Rosenblum			UUCP: {ucbvax, decvax}!ulysses!dsr
AT&T Bell Laboratories		ARPA: dsr@ulysses.att.com
600 Mountain Ave.		      dsr%ulysses@att.arpa
Murray Hill, NJ 07974-2070
(201) 582-2906
-------------------------------------------------------------------