On Mon, Jun 04, 2001 at 06:49:28PM -0500, Me wrote:
> Afaict, even with use strict at its most strict, perl 6
> can't (in practice) complain, at compile time, if
>
> $foo.Foun
>
> refers to an undeclared Foun.
>
> Right?
>
> Should there be a strict mode that warns if a
> method na
David Grove <[EMAIL PROTECTED]> writes:
>> Perl is far more practical than experimental.
> Not at the moment. That's the problem.
Pretty much everything proposed, even in the wildest RFCs during the
brainstorming phase, was still stuff that's been done elsewhere by other
languages. That's the
On Tue, 5 Jun 2001 [EMAIL PROTECTED] wrote:
> So I'd say no, Perl can't know at compile-time if your method is
> declared or not. Only in certain restricted cases, such as if you
> don't inherit from anything, or if *all* your parent classes are
> declared strictly.
(By 'strictly', I
I would like to suggest that this is one of the major advantages that Java
has over Perl. Getting things to "work" quickly in Perl is great. I like
that very much about Perl. But in the end, I'm most concerned that my code
is correct. Having the compiler check everything it can possibly check
Perl has strong typing; it just has a different notion of
what a "type" is. The "types" in Perl are SCALAR, ARRAY,
HASH, CODE, and a few others. Watch:
% perl -e 'sub foo(\@){} foo %h'
Type of arg 1 to main::foo must be array (not hash deref) at -e line 1, at EOF
Execution of -e aborted due to
> I would like to be able to use Perl for serious large-scale
> industrial-strength object-oriented projects, but the lack of strong
> compile-time type checking really prevents it, unfortunately.
Industrial-strength, as Chip says, is great, but also dangerous for pets
and small children.
On Tue, Jun 05, 2001 at 11:51:53AM -0400, John Porter wrote:
> Perl has strong typing; it just has a different notion of
> what a "type" is. The "types" in Perl are SCALAR, ARRAY,
> HASH, CODE, and a few others. Watch:
>
> % perl -e 'sub foo(\@){} foo %h'
> Type of arg 1 to main::foo must be ar
On Tue, Jun 05, 2001 at 08:24:31AM -0700, Daniel S. Wilkerson wrote:
> But in the end, I'm most concerned that my code is correct. Having
> the compiler check everything it can possibly check for me is really
> a requirement for that. Compile time type checking of method
> signatures is really h
Michael G Schwern wrote:
> Prototypes don't work on methods. And I wouldn't hold them up as
> being anything but a mediocre hack. Its not really type checking.
It's not just prototypes.
% perl -e '$r=\%h; print @$r'
Not an ARRAY reference at -e line 1.
Of course, that's a run-time check, but
Michael G Schwern wrote:
> If there's a class which isn't strictly defined anywhere in
> your hierarchy, no go.
For robust, mission-critical software, that can hardly
be called a negative.
> Of course, it probably only works with strict functional languages,
> which is very unPerlish.
It could
On Tue, Jun 05, 2001 at 12:49:41PM -0400, John Porter wrote:
> Michael G Schwern wrote:
> > If there's a class which isn't strictly defined anywhere in
> > your hierarchy, no go.
>
> For robust, mission-critical software, that can hardly
> be called a negative.
Not a negative, but realize that m
On Tue, Jun 05, 2001 at 07:33:55AM -0700, Dave Storrs wrote:
> (By 'strictly', I think you mean 'all methods (etc) are declared
> explicitly in code, not generated by AUTOLOAD, etc'. If I'm not
> understanding you correctly, please correct me.)
Yeah, pretty much. I put together a proof-of
On Tue, Jun 05, 2001 at 12:46:52PM -0400, John Porter wrote:
> Michael G Schwern wrote:
> > Prototypes don't work on methods. And I wouldn't hold them up as
> > being anything but a mediocre hack. Its not really type checking.
>
> It's not just prototypes.
>
> % perl -e '$r=\%h; print @$r'
> N
At 07:29 PM 6/5/01 +0100, Michael G Schwern wrote:
>Consider the following... Foo is a poster-child for a strict class.
>Everything is predeclared and typed. Its entire hierarchy is rock
>solid. Someone uses Foo in their script and calls Foo->bar. They
>also use Bar, a module you installed a lo
Michael G Schwern wrote:
> > % perl -e '$r=\%h; print @$r'
> > Not an ARRAY reference at -e line 1.
>
> This isn't type-checking (semantical arguments > /dev/null),
Heed your own redirection, eh?
> its more like basic syntax.
No, it's not. If it were, then it would be caught at
compile time.
On Tue, Jun 05, 2001 at 02:42:01PM -0400, John Porter wrote:
> > You don't want to try holding up prototypes and dereference checks to
> > Java's typing system and try to claim its in the same league, or even
> > the same sport.
>
> As I said before, it boils down to the fact that perl's notion of
From: Michael G Schwern [mailto:[EMAIL PROTECTED]]
>
> Before anyone gets the wrong idea, I don't think the solution is a
> drastic scaling back in Perl's flexibility. I just don't know what
> the solution is yet. Maybe it should be possible for a class to
> completely seal off its namespace to
I can't imagine any way in which one can consider Perl typing to be "strong".
When you know the type of a variable, you are supposed to have confidence that
when you see a statement
a - lexically locally (without looking around elsewhere) and
b - at compile time
you know exactly what the statement
On Tue, Jun 05, 2001 at 02:37:11PM -0500, Garrett Goebel wrote:
> > Before anyone gets the wrong idea, I don't think the solution is a
> > drastic scaling back in Perl's flexibility. I just don't know what
> > the solution is yet. Maybe it should be possible for a class to
> > completely seal of
On Tue, Jun 05, 2001 at 01:05:45PM -0700, Daniel S. Wilkerson wrote:
> 2 - You can't make a user defined type, like classes in Java, that
> are compile time checked.
Well, you can sort of: Attribute::Types. But that's not what John is
talking about.
--
Michael G. Schwern <[EMAIL PROTECTED]
Michael G Schwern wrote:
> On Tue, Jun 05, 2001 at 08:24:31AM -0700, Daniel S. Wilkerson wrote:
> > But in the end, I'm most concerned that my code is correct. Having
> > the compiler check everything it can possibly check for me is really
> > a requirement for that. Compile time type checking
Michael G Schwern [mailto:[EMAIL PROTECTED]] wrote:
> Of course, there's problems of order of definition. What happens if
> Bar.pm is loaded before Foo? Dunno.
simple sematics can be defined. If we see a declaration:
package Foo is encapulated;
then we throw an error if the namespace, Foo,
Daniel S. Wilkerson wrote:
> I can't imagine any way in which one can consider Perl typing to be "strong".
> When you know the type of a variable, you are supposed to have confidence
> that when you see a statement
> a - lexically locally (without looking around elsewhere) and
> b - at compile tim
> I would like to see some sort of "use really_strict" pragma which would
> disable at compile time the kinds of things you mentioned:
Yes, the point is to make this possible, not required. I thought Perl was
supposed to make "hard things possible." This is easy in Java and its not
even possibl
Daniel S. Wilkerson wrote:
> Michael G Schwern wrote:
> > Type checking is nice, but its just one class of error-checking.
> > Doesn't do squat for basic logic errors, for example.
>
> No, it does.
I think you're missing what ought to be an obvious point:
No amount of (sane) typing will allow y
If you call a method in Java, you can see right there which method you are
calling. You can then lexically follow the inheritance tree and find out exactly
what code really is called, what its signature is, and what it returns. Nothing
dynamic is involved.
One might ask for other featues, but I
On Tue, Jun 05, 2001 at 01:42:38PM -0700, Daniel S. Wilkerson wrote:
> Someone please tell me what automatic method generation is exactly.
Its the generation of large numbers of similar methods which would
otherwise be really tedious to write out by hand, such as accessor
methods. Without this,
On Tue, Jun 05, 2001 at 01:42:38PM -0700, Daniel S. Wilkerson wrote:
> Someone please tell me what automatic method generation is exactly.
package Foo;
sub AUTOLOAD {
my $method = $AUTOLOAD;
eval "sub $method { warn qq/Please do not call this method again.\n/ }"
goto &$method;
}
--
I flatter myself that I understand your point. It is doubtful we shall
have compilers that can tell you for example, that you used the wrong
algorithm.
However, perhaps I did not express my point as well as I could have. I
include the quote from Whitehead again, along with some others.
"By rel
Thank you, that's what I thought it might be. This can be done at compile time with a
two-stage
compilation. The first one writes the code that the second compiles. Then the
checking can be
done during the second stage.
Daniel
Michael G Schwern wrote:
> On Tue, Jun 05, 2001 at 01:42:38PM
Daniel S. Wilkerson wrote:
> If you call a method in Java, you can see right there which method you are
> calling.
> You can then lexically follow the inheritance tree and find out exactly
> what code really is called, what its signature is, and what it returns.
> Nothing dynamic is involved.
Pre
I apologize. I royally screwed up my original post.
I had meant to ask two minor specific yes/no answer
type questions about properties and stricture, that
were mutually unrelated. Instead I asked one major
open ended one.
In the hope that I haven't completely blown any
chance of getting answers
At 02:39 PM 6/5/2001 -0700, Daniel S. Wilkerson wrote:
>Thank you, that's what I thought it might be. This can be done at compile
>time with a two-stage
>compilation. The first one writes the code that the second
>compiles. Then the checking can be
>done during the second stage.
Not when the
Daniel S. Wilkerson wrote:
> It is doubtful we shall have compilers that can tell you for example,
> that you used the wrong algorithm.
Right. I think that's what Schwern was getting at, when he said
> > > > Type checking is nice, but its just one class of error-checking.
> By preventing lots
On Tue, Jun 05, 2001 at 01:34:35PM -0700, Daniel S. Wilkerson wrote:
> I cannot imagine running an enterprise critical application
As a complete digression, can we please strike the term "enterprise"
from the English lexicon? Completely redundant and drives me up the
wall. Almost as bad as "eco
On Tue, Jun 05, 2001 at 02:39:33PM -0700, Daniel S. Wilkerson wrote:
> Thank you, that's what I thought it might be. This can be done at
> compile time with a two-stage compilation. The first one writes the
> code that the second compiles. Then the checking can be done during
> the second stage
John Porter wrote:
> Daniel S. Wilkerson wrote:
> > It is doubtful we shall have compilers that can tell you for example,
> > that you used the wrong algorithm.
>
> Right. I think that's what Schwern was getting at, when he said
> > > > > Type checking is nice, but its just one class of error-ch
On Tue, Jun 05, 2001 at 05:49:30PM -0400, John Porter wrote:
> > By preventing lots of little gotchas, you free the mind to pay attention
> > to what it is doing rather than the most minute details of how to do
> > it. This is a quite powerful effect.
>
> Interesting you should mention this.
> I
On Tue, Jun 05, 2001 at 03:29:02PM -0700, Daniel S. Wilkerson wrote:
> It would be interesting for someone to measure that, however I doubt that it
> is so.
Oh, and look at what just showed up in my mailbox!
- Forwarded message from Tony Bowden <[EMAIL PROTECTED]> -
I think we should st
On Tue, Jun 05, 2001 at 04:38:24PM -0500, Me wrote:
> Question 1:
>
> Afaict, even with use strict at its most strict, perl 6
> can't (in practice) complain, at compile time, if
>
> $foo.Foun
>
> refers to an undeclared Foun.
>
> Right?
Can't you hear the low roar from the strong-
On Tue, Jun 05, 2001 at 11:14:29PM +0100, Michael G Schwern wrote:
> my $meth = "foo";
> $obj->$meth(); # $obj->foo();
>
> I'm probably using the wrong terms.
>
> This definately can't work if $obj is of a class which is strongly
> typed.
You would do that in Java by using reflection.
> Question 1:
>
> Afaict, even with use strict at its most strict, perl 6
> can't (in practice) complain, at compile time, if
>
> $foo.Foun
>
> refers to an undeclared Foun.
It could certainly warn you, but it can't object fatally since there's
always the p
>> Question 2:
>>
>> Afaict, even with use strict at its most strict, perl 6
>> can't (in practice) complain, at compile time, if
>>
>> $foo.Foun
>>
>> refers to an undeclared Foun.
>
> It could certainly warn you
Consider the code:
my $foo = 1
> On Tue, Jun 05, 2001 at 04:38:24PM -0500, Me wrote:
> > Question 1:
> >
> > Afaict, even with use strict at its most strict, perl 6
> > can't (in practice) complain, at compile time, if
> >
> > $foo.Foun
> >
> > refers to an undeclared Foun.
> >
> > Right?
>
> Can't you hear the
> Consider the code:
>
> my $foo = 1 is Found;
> &bar($foo);
>
> sub bar { my $baz = shift; if ($baz.Found) { ...} }
>
> Does the value of $baz have the Found property?
Yes.
> If so, does the compiler know that?
No. Because it only has the property at
>> Consider the code:
>>
>> my $foo = 1 is Found;
>> &bar($foo);
>>
>> sub bar { my $baz = shift; if ($baz.Found) { ...} }
>>
>> Does the value of $baz have the Found property?
>
> Yes.
>
>> If so, does the compiler know that?
>
> No. Because i
> So, is it right to say that one can't use stricture to avoid
> use of mistyped user defined value attached properties?
> (Perhaps with the exception of references to a value
> property in the same lexical scope as assignments of
> that value?)
>
> And, if this is so, then i
>> And, if this is so, then isn't it impossible to have useful
>> stricture about variable properties, because any given
>> reference to a property might be instead a value property
>> unknown to the compiler?
>
> Yes.
So:
You can't have (variable or value) property strictur
48 matches
Mail list logo