Perl 6 summary, 21-28 January, 2007

kudra on 2007-02-23T15:43:39

This week on the Perl 6 mailing lists

"Take the longest token, lie down and if the unease persists, write some code..."

-- Brad Bowman, in 'DFA/NFA context is non-local'

perl6-language

RAII in Perl6/Parrot

Previously on this thread, Blair Sutton asked if Perl 6 would be able to do RAII. He cited some articles which expressed the view that it was not possible in Python due to the fact that garbage collection does not offer deterministic finalization. This led to the question of whether Perl 6 would suffer from the same problem due to Parrot's style of garbage collection.

Larry Wall replied that deterministic reference counting was only one way to provide transactional security and timely destruction. He assured Blair that Perl 6 has ways to let you not care about some dependencies, while paying attention to others.

Blair appreciated Larry's explanation, and admitted to relying on the deterministic nature of C++, and using RAII to manage locks between threads and tear apart sockets cleanly. He asked for an example of Perl 6 offering the capability to execute code once every reference to an object has been removed. Luke Palmer replied that the LEAVE closure trait was a general method for addressing this.

This week, Blair posted a script in Perl 5 with a multi-threaded RAII idiom. Blair asked if the LEAVE closure trait takes the previous role of P5's DESTROY or if it will always be executed when one falls out of scope.

Numeric Semantics

Last week, the subthread was further expanded, with TSa suggesting that all rounding functions such as floor, round and trunc take an optional second argument which defines the jump size. TSa also proposed a number of division function pairs, such as fdiv and fmod for flooring division and modulus, or tdiv and tmod for truncating division and modulus. Smylers felt that this would introduce far too many functions in to the Perl core, given that few people would use them. Smylers felt that it was more appropriate to have them as modules. Jonathan Lang added that it was unlikely anyone would need multiple definitions of division and modulus at any given time, so modules made sense. The only question he saw was which definition was default, the mathematically elegant one or the industry standard one.

The main thread was revived when TSa replied to Luke Palmer's question of whether 1 is different from 1.0. TSa wanted 1 to be an Int and 1.0 to be a Num. There was some discussion with Jonathan Lang over the relationship between Int and Num, specifically which one does the other.

This week, Larry Wall put his foot down and stated that the default / operator is not going to do integer division and that this is not negotiable. Later in the thread, Larry said that for various practical reasons, he didn't think that Int can be treated as a subset of Num. He agreed that 1.0 == 1 !=== 1.0.

Larry's messages generated praise from Smylers, but TSa was not satisfied. However, he did not receive a noteworthy response this week.

[svn:perl6-synopsis] r13523 - doc/trunk/design/syn

This commit message by Larry Wall logged the following: "Tweak | to provide longest-token instead of short-circuit semantics. Now use || for old short-circuit semantics!" In a follow-up message, Larry elaborated:

This checking majorly changes the semantics of | within regex to support required longest-token matching semantics rather than left-to-right matching. It will enable us to write parsers more consistently, and it also opens up normal regexes to better optimization via tries and such. You can now use || for the old | semantics, which is majorly consistent with how | and || work outside of regexen.

Patrick Michaud asked if a similar situation would arise for & versus &&. Larry answered that, for reasons of consistency, that would indeed be the case.

The S13 "is commutative" trait

After reading that binary operators may be declared as commutative, Dave Whipp asked if this is restricted to only binary operators, or if he could tag any function/method with the trait. After a brief discussion, Larry replied that he had decided "is commutative" must die of ill-definedness. See instead the recent S13 change to support multiple signatures on a single body.

[svn:perl6-synopsis] r13529 - doc/trunk/design/syn

This commit, by Larry Wall, changes how regular expressions are analyzed. They are seen as pattern/action pairs and grammars as collections of those pairs. In addition 'token' is defined more rigorously.

Remember: Outlaw to declare a lexical twice in the same scope

Steve Lukas reminded people of a proposal from September which involved a change on S04 and linked to an earlier edition of this summary to describe the conclusions which had been reached. He requested that the changes be made. Carl Mäsak added that he also considered this to be an important issue. He wanted to see a warning when a lexical is declared twice in the same scope.

Dave Mitchell and Smylers clarified how it works in Perl 5 (it's possible, but generates a warning).

DFA/NFA context is non-local

Brad Bowman expressed his concern about the context dependence of DFA prefix mode. He felt this might be because he hadn't yet digested the new rules completely.

Smooth or Chunky?

Larry Wall asked for some advice with a missing generalization that he hadn't been able to work out yet. Given that zip and each produce similar results, he wondered what is the use of two functions which do almost the same thing. This led him to believe that zip should return something different and let the context determine whether the result should be flattened. This led to musings on a default smooth and an optional chunky, and a question on whether chunky should be the default when it makes more sense. He suggested various options.

Darren Duncan thought that the Perl 5 approach of default 'smooth' with optional 'chunking' was appropriate. As an example he offered the smooth map { $_, $_ * 10 }, 1..3 versus map {[$_, $_ * 10]}, 1..3. Larry replied that this was one function where the approach was possible, but that Perl 5 has many places where it fails to scale well to a multi-programmer team.

Ruud H.G. van Tol believed that it looked like a 'multiple faces' domain. He sees the dimensionally structured data as a living entity which should give different representations depending upon the requirements. As an example, he cited a meal, a recipe and a shopping list, adding that his preference was for the shopping list to be ordered by where things are found in the store. Brad Bowman suggested that the dimensional information should be retained, but that it might not need to be returned.

Ben Morrow proposed [[]] as a nice visual way to indicate that a list should be built. Blair Sutton listed several possible syntax options. Austin Frank joined in, offering the outverse of [;], namely ];[.

Map on a multislice

Joe Gottman wanted to know if map on a multislice performs deep or shallow iteration. He wanted to know what the default iteration level was and how to override it. Dr. Ruud added that there's also the option of depth first or width first.

perl6-internals

[perl #41185] [BUG]: examples/shootout/regexdna.pir.input: Persistently failing test

Earlier, in ticket [perl #41185], James Keenan reported a problem with a failing test in shootout.t on Mac OSX.

This week he reported that tests had passed for several weeks, but had recently started to fail again. He included the output of make test. As of February 6th, the test was still failing on Darwin.

Re: [perl #41230] [BUG] t/codingstd/perlcritic.t uses too many resources

Earlier, Jerry Gay complained that the perlcritic coding standards test was using resources, and asked in ticket [perl #41230] if someone could look in to this problem. Paul Cochrane reported that he thought there was a memory issue relating to critique() and that the memory was only freed up when the tests for a given policy are complete. Paul elaborated on what what he had attempted to address the issue.

This week Jerry Gay congratulated Jeffrey Thalhammer on version 1.01 of Perl::Critic, which solved the memory issue.

[perl #41267] [TODO] rename 'clip' pdd directory to 'draft'

In ticket [perl #41267], Jerry Gay announced that the clip directory had been renamed to draft.

[perl #41280] [PDD] adding methods to subs as objects

In ticket [perl #41280], Allison Randal quoted Patrick Michaud from IRC. Patrick explained that Larry Wall's most recent change to S05 would require adding the ability to attach methods to subs.

[perl #32667] [PATCH] IMCC - documentation needs updating

Bram Geron included a patch in ticket [perl #32667] which adds new syntax to docs/imcc/syntax.pod and fixes some typos. It also references where flags are explained. It was applied as r16678.

More embedding questions

Isaac Freeman explained that he needs an embedding interface which allows more control over the interpreter and cited some examples of control he required. He asked specifically about the ability to inspect and modify namespaces. chromatic pointed him to PDD 21, which is not completely implemented.

repository open for commits

Jerry Gay announced that the repository was now open for commits again, following the recent Parrot release.

[perl #41287] [PATCH] fix 0.4.8 announcement on parrotcode.org

Allison Randal created a ticket ([perl #41287]) with a patch to fix typos in the release announcement for 0.4.8. Will Coleda applied it.

[perl #41291] [BUG} Can't use null PMC with :multi sub

In ticket [perl #41291], Matt Diephouse included an example piece of code demonstrating the problem. Leopold Toetsch noted that a NULL PMC was never actually specced, but that he did consider it like a NULL pointer in C. He felt it was debatable whether the use Matt demonstrated should be allowed.

[perl #41292] [PATCH] make languages/cola/{lexer,parser}.c comply with coding standards

In ticket [perl #41292], James Bence submitted a patch to make the test t/codingstd/trailing_space.t pass. He felt it would be best to make a utility program which would eliminate trailing spaces.

Paul Cochrane asked which version of Parrot James was using, as the files involved should be marked as exempt because they are automatically generated. In r16702 the tests pass even without the patch.

Tcl, trace, profiling...

Will Coleda announced that he had two issues with the new Tcl implementation: speed and the implementation of trace. After noting that there is a way to set traces for Parrot subroutines, he requested the ability to declare hooks to call pre- and post sub invocations. Ideally these could be declared at compile time. He offered to write more complete specifications if the idea was interesting to others.

Allison Randal offered a few comments and requested the detailed proposal. Jerry Gay advised looking at Perl 5's Hook::LexWrap. Klaas-Jan Stol offered a suggestion which would leave the original subroutine untouched.

[perl #41293] [BUG]: t/compilers/tge/basic.t: Failed during 'make test' but passed with 'prove'

James Keenan reported a failing make test. This was ticket [perl #41293].

How handle the next parameter of invoke method in a PMC ?

François Perrad stated that in Lua, a metamethod __call is required. He included some code demonstrating what he would like to do, and noted that the code and some todo tests had been added.

[perl #41310] [CAGE] autogenerated PMC stubs kill compile

Allison Randal created ticket [perl #41310]. She reported that PMC stubs which are generated with tools/dev/gen_class.pl terminate the compilation the first time miniparrot is run because the new stub overrides the namespace method. She suggested ways in which this might be solved.

[perl #41312] [TODO] - Docs - update FAQ

In ticket [perl #41312], Will Coleda pointed out several outdated facets of the FAQ and requested that they be fixed.

[perl #41317] [PATCH] parrot component/interface stability classification

In ticket [perl #41317], Jerry Gay included a patch of a document classifying Parrot component and interface stability. He requested comments. Allison Randal approved of the document.

[perl #41320] [PATCH] Added rename() method to os.pmc

Ticket [perl #41320] contained Kay-Uwe Huell's patch with a rename function. It was applied as r16771.

[perl #41323] [CAGE] convert C<theINTERP> to C<interp>

Jerry Gay made a ticket ([perl #41323]) where he noted that any instances of theINTERP should be spelled as interp. Nuno Carvalho submitted a patch, which was applied as r16789. Jerry Gay was able to confirm that it worked for Win32 in addition to Linux.

[perl #41324] [PATCH] Eliminate '//'-style comments

Andy Dougherty submitted a patch to remove // comments, which were giving problems with his compiler. See ticket [perl #41324] for more information.

[perl #41325] [PATCH] Fill in missing pointer cast in

Andy Dougherty submitted a patch to allow Parrot to compile on his old Sun C compiler. He put it in ticket [perl #41325].

[perl #41326] [PATCH] Work around an optimization bug in Sun's WorkShop Compilers 4.2

In ticket [perl #41326], Andy Dougherty submitted a patch to work around an obscure bug in Sun's WorkShop Compilers 4.2.

[perl #41328] [BUG] pmc2c generates unnecessary code for void functions

Jerry Gay reported some warnings when compiling src/pmc/pmethod.c in ticket [perl #41328]. James Keenan explained the origin of the code in question, and advised moving the code to a branch until tests prove it suitable for trunk.

[perl #41329] [BUG]: Imposition of coding standards breaks tests in t/tools/pmc2cutils/

James Keenan noted, in ticket [perl #41329], that coding standards tests break some tests in t/tools/pmc2cutils. He believed that it happened in r16751, when code was changed to conform with the standards but wasn't run against the tests and submitted a patch to correct the problem. Paul Cochrane explained that he had run the tests, but that he hadn't done enough, and apologized.

[perl #41331] Imposition of coding standards breaks tests in tcl.

In ticket [perl #41331], Will Coleda referenced an earlier thread ([perl #41329] [BUG]: Imposition of coding standards breaks tests in t/tools/pmc2cutils/ ) which mentioned that some tests failed as a result of coding standards being applied. Several Tcl tests were failing. They were fixed by r16774.

__init vs. __init_pmc

Leopold Toetsch noted that some changes not too long before the release had broken pg.t. He found the problem in the object constructor, and mentioned that he'd made several attempts to unify object construction but that it wasn't very successful.

Matt Diephouse explained that he had made the change with Allison Randal's approval, to eliminate differences between PMCs and objects. Leopold replied that he thought the differences were confusing but that they still were. He linked to his proposal for method calling.

[PATCH] PIR language using PGE (2)

Klaas-Jan Stol submitted a patch for PIR using PGE. Jerry Gay applied it (with minor changes) as of r16831.

[perl #41353] [PATCH] Extended very limited PIO_unix_pipe() function in src/io/io_unix.c

Kay-Uwe Huell created ticket [perl #41353]. Included was a patch to extend the open function.

perl6-compiler

Parrot 0.4.8 Released

Jerry Gay announced the release of Parrot 0.4.8, "Eponymous".

Jarkko Hietaniemi questioned whether there was in fact extended support for Tru64, as he had only reported problems for subsystems like PGE. chromatic offered Jarkko commit access, but Jarkko declined.

Matt Diephouse volunteered to work on Tru64 if someone could give him access to a system. Nicholas Clark replied that HP gave access to a number of test systems, but not Tru64. Jarkko grumbled about HP's restriction. Unfortunately he was not able to provide a developer with Tru64 access. He thought that perhaps development on any 64-bit platform would already improve Parrot.

Acknowledgements

This summary was prepared using Mail::Summary::Tools, available on CPAN.

If you appreciate Perl, consider contributing to the Perl Foundation to help support the development of Perl.

Thank you to everyone who has pointed out mistakes and offered suggestions for improving this series. Comments on this summary can be sent to Ann Barcomb, kudra@domaintje.com.

Distribution

This summary can be found in the following places:

See Also