comp.lang.ada
 help / color / mirror / Atom feed
* single valued variables
@ 1987-04-07  5:26 drw
  0 siblings, 0 replies; 4+ messages in thread
From: drw @ 1987-04-07  5:26 UTC (permalink / raw)


"SVDSD::PETCHER@ti-eg.CSNET" writes:
> I am not an Ada expert, so correct me if I'm wrong, but...
> When one declares a variable range to be (true..true) is that not in itself a 
> contradiction?  A variable that can have only one value is, by definition, not 
> a variable, but a constant.  In that context, it seems a compiler should 
> create a constant, issue a diagnostic for any subsequent code that attempts to 
> change the constant, and generate no executeable code for same.  I realize the 
> most likely place for a single-valued variable to occur would be in 
> instantiation of a generic, but if a generic so instantiated does not treat 
> single-valued variables as constants then the program is basically in error.

I'm not well-versed in Ada, but methinks that such a variable is
inherently different from a constant in that one can/should be able to
assign to it--although there is only one value that can be assigned,
so it doesn't do very much!  Anything else leads to serious
nonuniformity.

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu
Un*x (a generic name for a class of OS's) != Unix (AT&T's brand of such)

^ permalink raw reply	[flat|nested] 4+ messages in thread
* single valued variables
@ 1987-04-03 12:14 SVDSD::PETCHER@ti-eg.CSNET
  1987-04-06 13:44 ` firth
  1987-04-08 19:29 ` gore
  0 siblings, 2 replies; 4+ messages in thread
From: SVDSD::PETCHER@ti-eg.CSNET @ 1987-04-03 12:14 UTC (permalink / raw)


I am not an Ada expert, so correct me if I'm wrong, but...
When one declares a variable range to be (true..true) is that not in itself a 
contradiction?  A variable that can have only one value is, by definition, not 
a variable, but a constant.  In that context, it seems a compiler should 
create a constant, issue a diagnostic for any subsequent code that attempts to 
change the constant, and generate no executeable code for same.  I realize the 
most likely place for a single-valued variable to occur would be in 
instantiation of a generic, but if a generic so instantiated does not treat 
single-valued variables as constants then the program is basically in error.

Malcolm

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1987-04-08 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-04-07  5:26 single valued variables drw
  -- strict thread matches above, loose matches on Subject: below --
1987-04-03 12:14 SVDSD::PETCHER@ti-eg.CSNET
1987-04-06 13:44 ` firth
1987-04-08 19:29 ` gore

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