Re: Properties and stricture and capabilities

2001-06-09 Thread James Mastros
From: [EMAIL PROTECTED] To: David L. Nicol [EMAIL PROTECTED] Sent: Friday, June 08, 2001 8:01 PM Subject: Re: Properties and stricture and capabilities On Thu, Jun 07, 2001 at 08:24:33PM -0500, David L. Nicol wrote: That would prevent further shoving of anything onto the symbol table without

Re: Properties and stricture and capabilities

2001-06-08 Thread schwern
On Thu, Jun 07, 2001 at 08:24:33PM -0500, David L. Nicol wrote: Symbol table manipulation will work as long as your mucking about doesn't alter the strict class's signature. ie. you can shove a code ref onto the symbol table as long as a stub for that method was defined at compile time.

Re: Properties and stricture

2001-06-07 Thread Michael G Schwern
Ok, I've realized a few things. 1) There's two sorts of type-checking going on here. Compile-time and run-time. 2) Run-time type checking is fairly easy and imposes few limitations. In fact, you can even do it now through ad hockery. 3) Compile-time type checking is a bit harder. Any

Re: Properties and stricture

2001-06-07 Thread Michael G Schwern
On Wed, Jun 06, 2001 at 10:28:41AM -0400, John Porter wrote: Michael G Schwern wrote: It will have to go for strict classes. @ISA will have to be locked. strict classes? strongly typed class? Can a man make up gibberish in peace? ;) Basically, any class which wants to be type-checked at

Re: Properties and stricture

2001-06-07 Thread Michael G Schwern
On Wed, Jun 06, 2001 at 07:06:49PM -0700, Dave Storrs wrote: But if we did, how could we hope to get a good new Star Trek series? : You're still hoping for a new, good Star Trek series??? You must be a Cubs fan. -- Michael G. Schwern [EMAIL PROTECTED]

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-07 Thread Michael G Schwern
On Wed, Jun 06, 2001 at 01:37:23AM -0500, Me wrote: BD languages What's BD? Bondage and Discipline, scum! You're not a good enough programmer to be trusted not to make mistakes! Now drop and give me fifty! -- Michael G. Schwern [EMAIL PROTECTED]http://www.pobox.com/~schwern/

Re: Properties and stricture

2001-06-07 Thread John Porter
Michael G Schwern wrote: Basically, any class which wants to be type-checked at compile time. I think the meaning of that is still not clear, given what strong typing usually means. -- John Porter

Re: Properties and stricture

2001-06-07 Thread John Porter
Michael G Schwern wrote: you can even do it now through ad hockery. Or odd hackery. :-) -- John Porter

Re: Properties and stricture

2001-06-07 Thread Daniel S. Wilkerson
This is similar to the solution they use in Java. You have an interface, which is compile time checked. Then, when you load a class at runtime, you check at load time that it satisfies the interface. You either get an exception right then, or you're fine. Daniel Michael G Schwern wrote:

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-07 Thread David H. Adler
On Wed, Jun 06, 2001 at 01:37:23AM -0500, Me wrote: Larry's MMV on that ;-) Man I really need to get up to speed with these acronyms. I know YMMV, is MMV a distant cousin perhaps? Same idea, except it's Larry's Milage in question, rather than Yours. dha -- David H. Adler - [EMAIL

Re: Properties and stricture and capabilities

2001-06-07 Thread David L. Nicol
Michael G Schwern wrote: Symbol table manipulation will work as long as your mucking about doesn't alter the strict class's signature. ie. you can shove a code ref onto the symbol table as long as a stub for that method was defined at compile time. a read-only hash of any kind makes it

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-06 Thread Me
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 stricture. Do

Re: Properties and stricture

2001-06-06 Thread Piers Cawley
Daniel S. Wilkerson [EMAIL PROTECTED] writes: Michael G Schwern wrote: No subroutine refs. No dynamic inheritance. No autoloading. No dynamic method calls. No symbol table manipulation. No eval. No automatic method generation. (That's off the top of my head). You don't loose all

Re: Properties and stricture

2001-06-06 Thread Piers Cawley
Michael G Schwern [EMAIL PROTECTED] writes: 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 long time

Re: Properties and stricture

2001-06-06 Thread John Porter
Michael G Schwern wrote: It will have to go for strict classes. @ISA will have to be locked. strict classes? my $meth = foo; $obj-$meth(); # $obj-foo(); This definately can't work if $obj is of a class which is strongly typed. strongly typed class? This can still work

Re: Properties and stricture

2001-06-06 Thread Me
[strict typing] Not a negative, but realize that many people find it of less value than the annoyances it brings with it (myself included) Michael, I don't know which is more impressive; the fact that use of a strictly typed language implies that a copy of you would land on the poor

Re: Properties and stricture

2001-06-06 Thread David L. Nicol
Me wrote: [strict typing] Not a negative, but realize that many people find it of less value than the annoyances it brings with it (myself included) Michael, I don't know which is more impressive; the fact that use of a strictly typed language implies that a copy of you would

closed property ((was Re: $foo.Foun ((was Re: Properties and stricture

2001-06-06 Thread David L. Nicol
Me wrote: I.Found your notion of a sealed off namespace intriguing. I have no idea what it meant just yet; I'm going to go read and think about it now. I'll pitch some syntax: # prevent modification to %reflexive:: like so: package reflexive is closed; # allow it

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-06 Thread David L. Nicol
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? it is already detectable. from perldoc perlref: Perl will raise an exception if you

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-06 Thread Me
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 is already detectable. from perldoc perlref: Perhaps for perl 5, but, aiui, Damian confirmed that my thinking about

Re: Properties and stricture

2001-06-06 Thread Dave Storrs
On Tue, 5 Jun 2001, Michael G Schwern wrote: 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

Re: Properties and stricture

2001-06-05 Thread schwern
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 name matches

Re: Properties and stricture

2001-06-05 Thread Dave Storrs
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

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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

Re: Properties and stricture

2001-06-05 Thread John Porter
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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 array (not

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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

Re: Properties and stricture

2001-06-05 Thread John Porter
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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' Not an

Re: Properties and stricture

2001-06-05 Thread Peter Scott
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 long

Re: Properties and stricture

2001-06-05 Thread John Porter
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. You

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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 a

RE: Properties and stricture

2001-06-05 Thread Garrett Goebel
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 the

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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 off its

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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]

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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 of

RE: Properties and stricture

2001-06-05 Thread David Whipp
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,

Re: Properties and stricture

2001-06-05 Thread John Porter
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 time you

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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 possible in

Re: Properties and stricture

2001-06-05 Thread John Porter
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 your

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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,

Re: Properties and stricture

2001-06-05 Thread Simon Cozens
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

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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

$foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Me
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

Re: Properties and stricture

2001-06-05 Thread Peter Scott
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

Re: Properties and stricture

2001-06-05 Thread John Porter
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 of

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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.

Re: Properties and stricture

2001-06-05 Thread Daniel S. Wilkerson
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-checking.

DANGER! ADVOCACY! (was Re: Properties and stricture)

2001-06-05 Thread Michael G Schwern
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. It is,

Re: Properties and stricture

2001-06-05 Thread Michael G Schwern
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 start

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Michael G Schwern
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-typing

Re: Properties and stricture

2001-06-05 Thread Damien Neil
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. There's

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Damian Conway
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

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Me
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 is Found;

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Me
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

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Damian Conway
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

Re: $foo.Foun (was Re: Properties and stricture)

2001-06-05 Thread Me
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