I couldn't determine if this involves just language, or just internals, so
I'm posting to both. Let me know if this discussion is inappropriate for
one or the other (or both?!).
On Thu, Aug 10, 2000 at 05:08:39AM +0000, David L. Nicol wrote:
>
> The other advantage of typed languages is that the run-time can
> be faster, and the storage streamlined.
The reason for the proposal is to show those who don't want typing that it
can be done in large part without involving radical changes to perl, or
requiring that everyone use it. As a result, you're not likely to get the
efficiency, either in storage or run-time, because the type checking is
layered on top of perl using tying and maybe some compiler hints.
> Typed things would only be able to accept data from things with compatbile
> types, or declared impliable conversions. Strict could force the conversion
> methods to be selected at compile time, with
>
> use strict typeconversions
>
> > Which then raises a few more problems (whew): how do you coax user input
> > (which is an SV) into a value $foo can accept with very-strict on?
>
> You run it through an explicit conversion process, like using C<atoi()> in
> a C program
Unfortunately, this involves more cooperation from the compiler; it has to
provide a way of declaring the return value of a subroutine. I'm not sure
if this is out of the question, it may be more generally useful outside of
type-checking.
> >; what
> > happens when an external function (say, from a module) is being very-strict,
> > but is passed arguments from code that doesn't do type checking?
>
> This is documented in the module's documentation, so (I say this at the
> risk of bringing on the wrath of those who hate C++ casting) a conversion
> method must be called.
I had also thought of the ability to write wrapper subroutines, with the
appropriately declared parameters and return value, for those modules and
subroutines that don't provide them.
The point is to leave it up to the person wanting type checking to make sure
it's working everywhere, and not force it on anyone else in -any- way.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--