Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Parameters and ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 146 of 211
Post > Topic >>

Parameters and discriminants (Extended Pascal)

by Frank Heckenbach <frank@[EMAIL PROTECTED] > Mar 15, 2005 at 01:19 PM

: If the parameter苯orm of the variable計arameter貞pecification contains a
: schema要ame, all of the corresponding actual計arameters contained by the
: activation計oint of an activation shall possess the same underlying負ype
: that is produced from the schema denoted by the schema要ame with a
tuple.

What does this mean? "The same type ... produced from a schema"
would seem to mean the same discriminants, but this can in general
only be checked at runtime, so shouldn't it have been a
dynamic-violation (or error) then, rather than "shall" (in
accordance with 3.2, note 1)?

I.e., should the program below be ok, a compile time error, or a
runtime error?

program foo;

type
  t (n: Integer) = array [1 .. n] of Integer;

var
  a, b: ^t;

procedure p (var a, b: t);
begin
end;

begin
  New (a, 42);
  New (b, 1);
  p (a^, b^)
end.

(Another paragraph below speaks of schematic types, but as these are
"discriminated" schemata, this refers to another case where it's
made clear that it's a dynamic-violation.)

I discussed the issue with Waldek Hebisch and he wrote: "Literally,
we should solve the halting problem... I think that this is an error
in the standard, and both value parameter case make clear what was
the intent: check at compile time that the same schema is used and
do check for equal tuples at runtime."

(For value parameters, the 2nd and 3rd paragraphs of 6.7.3.2 make it
an error or dynamic-violation resp. if the length (for `String') or
discriminants (for other schemata) don't match. -- Also a
dynamic-violation on mismatch when the formal parameter is a
schematic type via the rule of assignment-compatibility, except for
strings.)

So, are we missing something, or should we assume that a
dynamic-violation was meant in the paragraph above (and thus, the
program above should raise a runtime error)?

Frank

-- 
Frank Heckenbach, frank@[EMAIL PROTECTED]
 and PGP keys: http://fjf.gnu.de/plan
(7977168E)




 2 Posts in Topic:
Parameters and discriminants (Extended Pascal)
Frank Heckenbach <fran  2005-03-15 13:19:47 
Re: Parameters and discriminants (Extended Pascal)
John Reagan <john.reag  2005-03-15 16:15:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 5:55:26 CDT 2008.