comp.lang.ada
 help / color / mirror / Atom feed
From: mark@aoa.UUCP (Som Hane)
Subject: Re: Dynamic Typing in Ada
Date: 19 Mar 89 21:52:24 GMT	[thread overview]
Message-ID: <730@aoa.UUCP> (raw)
In-Reply-To: 8903101703.AA04518@ti.com

In article <8903101703.AA04518@ti.com> linnig@skvax1.csc.ti.com (Mike Linnig) writes:

>John Gateley's (Gateley@tilde.csc.ti.com) challenge was to implement the
>following lisp construct in Ada...
>
> ----------------------------------------------------------------------
>-- Scheme                           CL
>-- (define print                    (defun print (x)
>--   (lambda (x)                      (typecase x
>--     (cond                            (integer 1)
>--       ((integer? x) 1)               (real 2)
>--       ((real? x) 2)                  (complex 3)
>--       ((complex? x) 3)               (vector 4)))
>--       ((vector? x) 4))))
> ----------------------------------------------------------------------
>package dynamic_types is
>
> [ Ada code deleted ]
>
>I think this answers John Gateley's (Gateley@tilde.csc.ti.com) dynamic
>typing challenge. I didn't understand the first challenge; if it involved
>something similar to The C Language construct allowing pointers to
>procedures (and calling them) that can be handled too.
>

Let me start off by saying that I am a Lisp ( and C ) programmer, and have
only been doing Ada for 1 year, so I may be totally off base, but... I
think you may have missed the point.  In the CL example above the type of
"x" could be set or changed dynamically;  in your Ada example it was ( and
had to be ? ) set at compile time.  In addition, in the CL example the range
of choices in the typecase itself could be modified dynamically to be the
members of an arbitrary set of types ( some of which could themselves have
been dynamically created ).  I do not see at all how your example can be
modified to do any of these things... so I think the challenge has not been
met.

	Mark Reynolds

	...!BBN.COM!bbn!aoa!mark
	mark%aoa.uucp@BBN.COM

  reply	other threads:[~1989-03-19 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-03-10 16:49 Dynamic Typing in Ada Mike Linnig
1989-03-19 21:52 ` Som Hane [this message]
1989-03-24 18:42   ` Scott Moody
replies disabled

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