🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6263

Modula-2 Cast Syntax (was Re: What is B&D? (...))

#6263
From: Clay Phipps
Date: Tue, 31 Jan 1989 07:29
38 lines
2488 bytes
In article <186@m2xenix.UUCP> randy@m2xenix.UUCP (Randy Bush) writes:
>... The professor heard the pleas.  Modula-2 has unchecked casts.  

I would prefer the current (existing) form (as I understand it), 
because it seems to require the least special-case compiling.

>   pointer := PointerTypeName ( ArbitraryValueOfSameNumberOfBits )
               ^^^^^^^^^^^^^^^   
In the first example, any apparent function reference whose function-id
is the name of a type must be treated as a cast; however,
the expression within the parentheses can be evaluated just as it
would be as the actual-parameter for a function invocation.

>Or the new form being suggested in recent ISO work
>
>   pointer := SYSTEM.CAST ( PointerTypeName, ArbitraryValueOfSameNumberOfBits )
               ^^^^^^ ^^^^   ^^^^^^^^^^^^^^^
In the second example, any apparent function reference with the special name
"SYSTEM.CAST" (or more likely, first "SYSTEM", then "CAST") must be treated 
as a special case.  Furthermore, the first actual parameter must be treated 
as a special-case, because it is the name of the target type, not an
expression to be evaluated. 
Only the last actual parameter can be evaluated normally.

I think of the first example as requiring only 1 special-case decision
(trivially handled with semantic actions during parsing),
and the second example as requiring 2 of them
(still straightforward to handle with semantic actionsa, but not as simple).

What does the decreased simplicity of handling the second example buy ISO ?
Is the ISO proposal trying to make way for a distinction between
casts and conversions (the latter changing the bit patterns, e.g., 
from that for floating 0.1e2 to string '10.0' or integer 10) ?
-- 
[The foregoing may or may not represent the position, if any, of my employer]
 
Clay Phipps                       {ingr,pyramid,sri-unix!hplabs}!garth!phipps
Intergraph APD, 2400#4 Geng Road, Palo Alto, CA 93403            415/494-8800
Technical Details
Message-ID: <2493@garth.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!ames!zodiac!joyce!sri-unix!garth!phipps
References: <8784@megaron.arizona.edu> <186@m2xenix.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!ames!zodiac!joyce!sri-unix!garth!phipps
From: phipps@garth.UUCP (Clay Phipps)
Newsgroups: comp.lang.misc
Subject: Modula-2 Cast Syntax (was Re: What is B&D? (...))
Message-ID: <2493@garth.UUCP>
Date: 31 Jan 89 07:29:32 GMT
References: <8784@megaron.arizona.edu> <186@m2xenix.UUCP>
Reply-To: phipps@garth.UUCP (Clay Phipps)
Organization: INTERGRAPH (APD) -- Palo Alto, CA
Lines: 38