Regards,
-- Gregor
--
Gregor Purdy gre...@focusresearch.com
Focus Research, Inc. http://www.focusresearch.com/
> 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
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
Well, obviously this is one of those places where the implementation
is the spec. :-)
Larry
> 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
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}';
I think that works... I only read E7 through once and quickly, so I'll
have to double check that against Perl6::Form;
Luke
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?
>>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
> 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
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.
> 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
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.
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
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.
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