Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exegesis 7: Overflow Fields

2 views
Skip to first unread message

Gregor N. Purdy

unread,
Feb 28, 2004, 10:27:12 AM2/28/04
to perl6-l...@perl.org
In "And now at length they overflow their banks." its not clear
how an overflow field gets tied to its initial non-overflow field.
In the recipe example given, how does it know to go with the
$method field instead of the $prep_time field? Is it basing off
of matching the horizontal extent of the initial field? If so,
are error messages generated if there is overlap?


Regards,

-- Gregor

--
Gregor Purdy gre...@focusresearch.com
Focus Research, Inc. http://www.focusresearch.com/

Smylers

unread,
Feb 28, 2004, 10:39:24 AM2/28/04
to perl6-l...@perl.org
Gregor N. Purdy writes:

> In "And now at length they overflow their banks." its not clear
> how an overflow field gets tied to its initial non-overflow field.
> In the recipe example given, how does it know to go with the
> $method field instead of the $prep_time field?

The definition given is:

An overflow field automagically duplicates the field specification
immediately above it.

The method field is immediately above the overflow field; the
preparation time field isn't.

Smylers

Gregor N. Purdy

unread,
Feb 28, 2004, 2:59:15 PM2/28/04
to Smylers, perl6-l...@perl.org
Smylers --

So, what I'm looking for is more explicit phrasing around "immediately
above". In the example, the column range for the overflow field is
exactly the same as that of the $method field in the prior "picture".
But, what does it do if it doesn't match *exactly*? Is it an error,
does it have some heuristics to guess? What are the edge cases?


Regards,

-- Gregor

Larry Wall

unread,
Feb 28, 2004, 3:33:37 PM2/28/04
to perl6-l...@perl.org
On Sat, Feb 28, 2004 at 11:59:15AM -0800, Gregor N. Purdy wrote:
: Smylers --

:
: So, what I'm looking for is more explicit phrasing around "immediately
: above". In the example, the column range for the overflow field is
: exactly the same as that of the $method field in the prior "picture".
: But, what does it do if it doesn't match *exactly*? Is it an error,
: does it have some heuristics to guess? What are the edge cases?

Well, obviously this is one of those places where the implementation
is the spec. :-)

Larry

Damian Conway

unread,
Feb 28, 2004, 5:07:09 PM2/28/04
to perl6-l...@perl.org
Gregor N. Purdy wrote:

> So, what I'm looking for is more explicit phrasing around "immediately
> above". In the example, the column range for the overflow field is
> exactly the same as that of the $method field in the prior "picture".
> But, what does it do if it doesn't match *exactly*? Is it an error,
> does it have some heuristics to guess? What are the edge cases?

It's implementation-defined. And the implementation currently does this:

* Compare the span of the overflow field with the spans
of each field in the previous format.

* Each preceding field that overlaps the overflow field in any
way (i.e. that spans even a single column spanned by the
overflow field) is a candidate.

* The left-most candidate is taken as the field to be overflowed

* A warning is issued if there are two or more candidates, unless
all the candidates have the same data source.

Damian

Mark A. Biggar

unread,
Feb 28, 2004, 4:08:21 PM2/28/04
to perl6-l...@perl.org
Larry Wall wrote:

Arn't there cases where the overflow field want to be bigger then the
first field? Something the ends up looking like:

LABEL: texttexttextexttexttext
texttextexttextetexttexttextte
xttexttexttexttexttexttextttex

where LABEL is in one field and text... is in an oveflow block?

--
ma...@biggar.org
mark.a...@comcast.net

Luke Palmer

unread,
Feb 28, 2004, 7:00:42 PM2/28/04
to Mark A. Biggar, perl6-l...@perl.org

Yeah. I'd do that this way:

form '{<<<}: {<<<<<<<<<<<<…}',
$label, $text,
'{…<<<<<<<<<<<<<<<<<<…}',
$text,
'{VVVVVVVVVVVVVVVVVVVV}';

I think that works... I only read E7 through once and quickly, so I'll
have to double check that against Perl6::Form;

Luke

Mark A. Biggar

unread,
Feb 28, 2004, 7:08:32 PM2/28/04
to Luke Palmer, perl6-l...@perl.org
Luke Palmer wrote:

Expect wouldn't that produce a extra blank line if $text is short? Or
do follow on blocks automatically do the perl 5 '~' thing? Overflow
blocks as well? Do we need a :option to control that. What if I
want a follow-on or overflow block to not suppress extra blank lines?

--
ma...@biggar.org
mark.a...@comcast.net

Damian Conway

unread,
Feb 28, 2004, 7:18:32 PM2/28/04
to perl6-l...@perl.org
Luke Palmer wrote:

>>Arn't there cases where the overflow field want to be bigger then the
>>first field? Something the ends up looking like:
>>
>>LABEL: texttexttextexttexttext
>>texttextexttextetexttexttextte
>>xttexttexttexttexttexttextttex
>>
>>where LABEL is in one field and text... is in an oveflow block?
>
>
> Yeah. I'd do that this way:
>
> form '{<<<}: {<<<<<<<<<<<<…}',
> $label, $text,
> '{…<<<<<<<<<<<<<<<<<<…}',
> $text,
> '{VVVVVVVVVVVVVVVVVVVV}';

Exactly.


And more often I think you'd actually want:

LABEL: texttexttextexttexttext
texttexttextexttexttext
texttextexttextetexttexttextte
xttexttexttexttexttexttextttex

which is even easier:

form '{<<<}: {<<<<<<<<<<<<<}',
$label, $text,
' {VVVVVVVVVVVVV}',
'{VVVVVVVVVVVVVVVVVVVV}';


Damian

Damian Conway

unread,
Feb 28, 2004, 7:31:59 PM2/28/04
to perl6-l...@perl.org
Mark A. Biggar wrote:

> Expect wouldn't that produce a extra blank line if $text is short?

Nope. Formats only generate text lines if at least one of their fields
interpolates at least one character.

Damian

Mark A. Biggar

unread,
Feb 28, 2004, 7:38:12 PM2/28/04
to Damian Conway, perl6-l...@perl.org
Damian Conway wrote:

What if I want to interpolate an empty string and let the fill
characters work? If the above is the default I still need someway
to turn it off.


--
ma...@biggar.org
mark.a...@comcast.net

Damian Conway

unread,
Feb 29, 2004, 6:39:05 PM2/29/04
to perl6-l...@perl.org
Mark A. Biggar wrote:

> What if I want to interpolate an empty string and let the fill
> characters work?

Then you interpolate a single fill character instead of the empty string.

Damian

Mark A. Biggar

unread,
Feb 29, 2004, 7:13:52 PM2/29/04
to Damian Conway, perl6-l...@perl.org
Damian Conway wrote:

But that means I have to pre-process data lists that just happen to
contain empty strings so that they won't disappear on me. This seems to
violate least suprise.

This message brought to you by SFTPODAES
"Society For The Prevention of Descrimination Against Empty Strings".
Motto: Empty Strings Are Valid Data Too.

--
ma...@biggar.org
mark.a...@comcast.net

Damian Conway

unread,
Feb 29, 2004, 7:31:26 PM2/29/04
to perl6-l...@perl.org
> But that means I have to pre-process data lists that just happen to
> contain empty strings so that they won't disappear on me.

Huh? An empty string already *has* disappeared on you. ;-)


> This seems to violate least surprise.

I'd be much more surprised if an empty string *didn't* disappear.
After all, you wouldn't expect:

$str1 = "nothing" . "to" . "see";

to be different from:

$str1 = "nothing" . "" . "to" . "" . "see";


Damian

Mark A. Biggar

unread,
Feb 29, 2004, 7:39:42 PM2/29/04
to Damian Conway, perl6-l...@perl.org
Damian Conway wrote:

I also don't expect

$x = '';
$y = "aaaa $x bbbb";

to assign '' to $y either, but that's the equlvalent of what you say
form() will do.

I was more worried about arrays of items some of which are empty strings
and having items disappear out my repost because form() throws them
away.


--
ma...@biggar.org
mark.a...@comcast.net

Damian Conway

unread,
Feb 29, 2004, 7:54:41 PM2/29/04
to perl6-l...@perl.org
> I also don't expect
>
> $x = '';
> $y = "aaaa $x bbbb";
>
> to assign '' to $y either, but that's the equlvalent of what you say
> form() will do.

I see your point.


> I was more worried about arrays of items some of which are empty strings
> and having items disappear out my repost because form() throws them
> away.

The behaviour is a little more sophisticated than I have hitherto tried to
explain. Try this:

use Perl6::Form;

my @data = ("foo","bar","","baz");

print form "| {[[[[[[[} |", \@data;

print "====================\n";

print map {form "| {[[[[[[[} |", $_} @data;


Damian

0 new messages