Re: clarify: does Dog is Mammal load Mammal for you?
In a message dated Mon, 21 Aug 2006, Jonathan Scott Duff writes: But, assuming for the moment that Cis Mammal autoloads CMammal.pm, does that mean that class Dog is Mammal-4.5 is valid? Yes, it must be valid. See http://dev.perl.org/perl6/doc/design/syn/S11.html#Versioning : So you can just say my Dog $spot .= new(woof); and it knows (even if you don't) that you mean my Dog-1.3.4-cpan:JRANDOM $spot .= new(woof); For this not to extend to subclassing seems bizarre. This seems like something we shouldn't encourage as it tends toward tight coupling of implementations where it should be tight coupling of abstractions. Different sites have different needs. Sites with strong regulatory or auditing requirements to not modify existing code without review (where the definition of modifying includes changing upstream dependencies) must be able to specify the longname of classes in this context. Tight coupling should not be encouraged, but it must be allowed for these cases. My question is, if a program is running where two versions of Dog are loaded, say 1.3.4 and 2.1, and a file contains: use Dog-1.3.4-cpan:JRANDOM; class Poodle is Dog { ... } will the compiler know that 'Dog' in this file must always refer to 1.3.4, and not 2.1, as most other references to the shortname would? If not, sites that need dependency stability will have to write use Dog-1.3.4-cpan:JRANDOM; class Poodle is Dog-1.3.4-cpan:JRANDOM { ... } which I don't necessarily have any problem with, but this behavior needs to be defined. Incidentally, isn't C(Any) in longnames supposed to be * now? S11 still uses C(Any). Trey
Re: clarify: does Dog is Mammal load Mammal for you?
Oops, Luke Palmer alerted me to the fact that I screwed up in the below. In a message dated Tue, 22 Aug 2006, Trey Harris writes: My question is, if a program is running where two versions of Dog are loaded, say 1.3.4 and 2.1, and a file contains: use Dog-1.3.4-cpan:JRANDOM; class Poodle is Dog { ... } will the compiler know that 'Dog' in this file must always refer to 1.3.4, and not 2.1, as most other references to the shortname would? If not, sites that need dependency stability will have to write I misstated my worry here. In this case, by the same rule that my Dog $foo gets the right version because the longname is aliased to the shortname in the lexical scope of the use, it would work. What I'm actually concerned about is the case where the Dog CPAN distribution includes Poodle.pm. I think that we need Poodle.pm to be written like: use Dog-1.3.4-cpan:JRANDOM; class Poodle-1.3.4-cpan:JRANDOM is Dog { ... } If it's written: use Dog; class Poodle-1.3.4-cpan:JRANDOM is Dog { ... } then in a running Perl program that has previously loaded Dog-2.1-*, Poodle-1.3.4 will become a subclass of Dog-2.1, which causes any code using Poodle-1.3.4 to be unable to protect itself from an unforseen upstream dependency change. Such wordiness seems unfortunate and error-prone. I don't believe the specs yet have anything to say about how filesystem layout exists in the world of versioned packages, but it would be nice if a distribution's packages can use a shortname and automatically refer to other packages in the same distribution before the compiler looks elsewhere within %*INC (or its moral equivalent). Trey
Re: clarify: does Dog is Mammal load Mammal for you?
On Tue, Aug 22, 2006 at 12:37:33AM -0700, Trey Harris wrote: I misstated my worry here. In this case, by the same rule that my Dog $foo gets the right version because the longname is aliased to the shortname in the lexical scope of the use, it would work. What I'm actually concerned about is the case where the Dog CPAN distribution includes Poodle.pm. I think that we need Poodle.pm to be written like: use Dog-1.3.4-cpan:JRANDOM; class Poodle-1.3.4-cpan:JRANDOM is Dog { ... } If it's written: use Dog; class Poodle-1.3.4-cpan:JRANDOM is Dog { ... } then in a running Perl program that has previously loaded Dog-2.1-*, Poodle-1.3.4 will become a subclass of Dog-2.1, which causes any code using Poodle-1.3.4 to be unable to protect itself from an unforseen upstream dependency change. This is precisely the problem which unix shared libraries have to face (so yes, it's a real problem), and which is handled by a combination of sonames and versioned symbols. It seems to me that there is some merit in considering similar features here. The essential features are: - independent version labels for the interface and implementation, so you can change the implementation while promising that the external interface remains the same - individual symbols can be optionally decoupled from the interface version of the library that contains them and versioned independently, so even though the interface version has changed from X to Y, the linker knows that only function foo has changed; clients that use only function bar will still find this version acceptable. Shared libraries make this behaviour optional, with the first being all that most people use, and the second only being used by people writing large libraries with complex needs (like glibc). You can get interface versions with nothing more than a stipulation that Poodle-1.* will always have the same interface, but everybody has to understand what this means for it to work. I'm not sure if this is the right approach here. It is not clear to me whether it is practical to version individual symbols in perl6 as it currently stands, but it would appear to be worthwhile to make sure this is possible. I suspect that this will largely be a matter of establishing appropriate conventions about versioning for CPAN modules.
Integrating the Pugs test suite into the Synopses
Hi, there~ When you see the title, you may wonder what that means. Here is the answer: http://feather.perl6.nl/~agentzh/syn/S04.html Search for links named like Show the snippet from ... and click on them to find out what will happen. :) Well, in short, we have divided the .t files in the Pugs test suite into pieces and inserted every resulting snippet after the corresponding paragraph of the Synopses. The job was done by the Perl 5 script util/smartlinks.pl living in the Pugs source tree. And all the *.html under http://feather.perl6.nl/~agentzh/syn/ are updated every hour with the latest Synopses and Pugs test suite. Thanks to the cron program on feather. ;-) At this point, there is a question. How does smartlinks.pl manage to determine which snippet of the tests corresponds to which paragraph of a certain synopsis? Hmm, I'm sure you may have already found the answer from the web pages. There's hundreds of smartlinks spreading over the whole test suite in the form of comments. Here're two examples: # LS04/The do-once loop/can't put while or until modifier # LS04/Switch statements /is exactly equivalent to You see, the smartlink has its deep root in our POD, but contains an extra keyword list after the second slash. This list of keywords specifies which paragraph in the given section is relevant to the tests right below the comment. Multiple adjacent smartlinks can share the same group of tests: # LS02/Context/boolean ? # LS03/Changes to Perl 5 operators/? imposes boolean context { ... } Please see t/README in Pugs repository for more detailed information on smartlinks: http://svn.openfoundry.org/pugs/t/README Embedding test snippets into the Synopses has several benefits: * Providing more sample code to the Synopses Synopses are known for their rich samples. Unfortunately, the sample code our Synopses are not enough at all. Many sections go without sample code. On the other hand, the Pugs test suite contains tens of thousands of tests, which can certainly serve as very good examples as long as they are correct and up-to-date. * Intuitive estimation for the quality of the tests When we browse the web pages with test snippet embedded, it's quite easy to figure out the validity and also the completeness of the test suite. For instance, if a whole section has no snippet links at all, then that probably means we need to add more tests as well as smartlinks. These HTML pages are good visual coverage reports per se. Also, the correctness of a group of tests is easiest to determine if it appears right in the context of the synopses. Currently we also have TODO and SKIP marks in the test suite, hence we can get a good estimation for how much of the Synopses are implemented by Pugs at a quick glance. * Easier to detect mismatch between tests and docs Everyone who has subscribed p6l can see the Synopses are changing pretty fast. In contrast, many tests in the Pugs test suite are terribly out of date even though Larry has the habit of updating some tests after updating the documents. But if we have enough smartlinks distributed in the test suite, the mismatch between tests and docs can be detected in the form of broken links. To get a list of broken links, we only need a single command: $ util/smartlinks.pl --check t/*/*.t t/*/*/*.t Unmatched smartlinks (if any) will be reported in great detail: ERROR: t/operators/quoting.t: line 173: pattern ``/Split result on words (no quote protection)/'' failed to match any paragraph in LS02/Literals. ERROR: t/data_types/arglist.t: line 6: section ``Operator renaming'' not found in S03. As I told Juerd on #perl6, the initial motivation of developing smartlinks.pl is simply to make myself more motivated to contribute tests to Pugs. Thanks to other Pugs members who worked on the smartlinks long before I joined the Pugs team. Without their work, smartlinks.pl won't produce anything meaningful today. :) This mail is also posted to Audrey's blog in the form of HTML: http://pugs.blogs.com/pugs/2006/08/integrating_the.html POD++ Cheers, Agent
Re: Dumb doc question...
On 8/21/06, Agent Zhang [EMAIL PROTECTED] wrote: http://svn.berlios.de/svnroot/repos/unisimu/Perl/Syn/ This position is no longer maintained. Please see http://feather.perl6.nl/~agentzh/syn/ instead. The .html pages there are updated every *one* hour by the cron program on feather. So they're guaranteed to be up-to-date. Cheers, Agent
[svn:perl6-synopsis] r11316 - doc/trunk/design/syn
Author: pmichaud Date: Tue Aug 22 11:00:04 2006 New Revision: 11316 Modified: doc/trunk/design/syn/S05.pod Log: Change If the first character after the angle is whitespace to If the first character after the identifier is whitespace for before regex constructs. Modified: doc/trunk/design/syn/S05.pod == --- doc/trunk/design/syn/S05.pod(original) +++ doc/trunk/design/syn/S05.podTue Aug 22 11:00:04 2006 @@ -641,7 +641,7 @@ foo('bar') -If the first character after the angle is whitespace, the +If the first character after the identifier is whitespace, the subsequent text (following any whitespace) is passed as regex, so: foo bar
Heredoc issue in pugs.
#!/usr/bin/env pugs my $a = q:t /END/ test END; $a.perl.say; Above example works ok in pugs, But the problem is. From S02 Heredocs are no longer written with , but with an adverb on any other quote construct: print qq:to/END/; Give $amount to the man behind curtain number $curtain. END Which is correct?
Re: Heredoc issue in pugs.
On Wed, Aug 23, 2006 at 02:16:11AM +0800, Yiyi Hu wrote: : #!/usr/bin/env pugs : : my $a = q:t /END/ : test : END; : : $a.perl.say; : : Above example works ok in pugs, But the problem is. : From S02 : : Heredocs are no longer written with , but with an adverb on any : other quote construct: : :print qq:to/END/; :Give $amount to the man behind curtain number $curtain. :END : : Which is correct? Both of them are. See the table further down that says: Short LongMeaning = === ... :t :to Interpret result as heredoc terminator ... Larry
Re: Heredoc issue in pugs.
: my $a = q:t /END/ : test : END; :print qq:to/END/; :Give $amount to the man behind curtain number $curtain. :END : Which is correct? Both of them are. See the table further down that says: What about the semicolon? After the terminator, or after the opening line? -- Your inertially corrupt space-time disagrees with me. -- Will McCarthy http://surreal.istic.org/ It sounded right in my head. pgpT6nAXOuFGs.pgp Description: PGP signature
Re: Heredoc issue in pugs.
On Tue, Aug 22, 2006 at 08:12:09PM +0100, Daniel Hulme wrote: : : my $a = q:t /END/ : : test : : END; : : :print qq:to/END/; : :Give $amount to the man behind curtain number $curtain. : :END : : : Which is correct? : : Both of them are. See the table further down that says: : : What about the semicolon? After the terminator, or after the opening : line? Ah, missed that, thanks. On the opening line is correct, just as in Perl 5. The heredoc is just a term with some indirection, and the indirection is completely line oriented. The terminator must still be on a line by itself, with nothing but whitespace. We could just as easily have a POD indirection that said print qq:from/FOO/; and it would go looking for the nearest =begin FOO block to insert. So syntactically, it's only sort of happenstance that with heredocs the document happens to be here. The inline-ness of it is secondary to the line-orientedness of it, in my mind. And it is often not, in fact, truly inline, as demonstrated by print qq:to/FOO/, qq:to/BAR/; ... FOO ... BAR It's really just a way to abstract a large string containing newlines into a single token that doesn't. Larry
Re: Heredoc issue in pugs.
On 8/22/06, Larry Wall [EMAIL PROTECTED] wrote: print qq:from/FOO/; On a somewhat related, somewhat unrelated note, I am a little bit worried about the false duality of :to and :from. Luke
Re: Heredoc issue in pugs.
On Tue, Aug 22, 2006 at 08:32:52PM +, Luke Palmer wrote: : On 8/22/06, Larry Wall [EMAIL PROTECTED] wrote: : print qq:from/FOO/; : : On a somewhat related, somewhat unrelated note, I am a little bit : worried about the false duality of :to and :from. Well, that's kinda why theres's no :from actually. It was probably not beneficial to bring in a counterfactual example. Pod docs would actually come in through %=PODFOO or some such. Heredocs are a little more special because they have to interpolate from the local lexical pad, so in that sense they really are a bit more in-line-ish. Larry
Re: Heredoc issue in pugs.
On Wed, Aug 23, 2006 at 02:16:11AM +0800, Yiyi Hu wrote: #!/usr/bin/env pugs my $a = q:t /END/ test END; $a.perl.say; Above example works ok in pugs, But the problem is. From S02 Heredocs are no longer written with , but with an adverb on any other quote construct: print qq:to/END/; Give $amount to the man behind curtain number $curtain. END Which is correct? If I remember correctly, Larry and Audrey discussed this at the Chicago hackathon and updated the Synopsis at that time. So my guess is that the Synopsis is correct. -kolibrie