List Info

Thread: why is pod not allowed within expressions?




why is pod not allowed within expressions?
user name
2007-08-16 12:35:22
     if (something() and

=head3  Additional Check
we check for something_additional now, in addition to just
something
=cut

        something_additional()){
                ...

fails.

Is this by design?

-- 
"Simplicity is one of the most misunderstood concepts
in programming" -- Matz

Re: why is pod not allowed within expressions?
user name
2007-08-16 16:50:42
"David Nicol" <davidnicolgmail.com> writes:

>      if (something() and
>
> =head3  Additional Check
> we check for something_additional now, in addition to
just something
> =cut
>
>         something_additional()){
>                 ...
>
> fails.
>
> Is this by design?

Consider this:

---- snip ----
sub head3() { }

my $x

=head3

;
---- snip ----

See?

-- Johan

Re: why is pod not allowed within expressions?
user name
2007-08-22 01:29:06
On 8/16/07, David Nicol wrote:
>      if (something() and
>
> =head3  Additional Check
> we check for something_additional now, in addition to
just something
> =cut
>
>         something_additional()){
>                 ...
>
> fails.
>
> Is this by design?
>

Probably, since it's documented. From "perldoc
perlsyn", the section
titled "PODs: Embedded Documentation":

       Perl has a mechanism for intermixing documentation
with source code.
-->   While it's expecting the beginning of a new
statement, <--
       if the compiler encounters a line that
       begins with an equal sign and a word, like this

Cheers,
-- 
Offer Kaye

Re: why is pod not allowed within expressions?
user name
2007-08-22 12:01:44
On 8/22/07, Offer Kaye <offer.kayegmail.com> wrote:
> [...] it's documented. From "perldoc
perlsyn", the section
> titled "PODs: Embedded Documentation":
>
>        Perl has a mechanism for intermixing
documentation with source code.
> -->   While it's expecting the beginning of a new
statement, <--
>        if the compiler encounters a line that
>        begins with an equal sign and a word, like this

Would anyone be into a patch that changed the test from
"While it's
expecting the beginning of a new statement" to
"Anywhere except
immediately following something that could be construed as
an l-value?"

Also included in this wishlist item would be a warning when
a line following
a l-value matches /^=w/.

I actually doubt anyone besides myself is routinely annoyed
by this.


Re: why is pod not allowed within expressions?
user name
2007-08-22 16:32:47
David Nicol wrote:
> On 8/22/07, Offer Kaye <offer.kayegmail.com> wrote:
>   
>> [...] it's documented. From "perldoc
perlsyn", the section
>> titled "PODs: Embedded Documentation":
>>
>>        Perl has a mechanism for intermixing
documentation with source code.
>> -->   While it's expecting the beginning of a
new statement, <--
>>        if the compiler encounters a line that
>>        begins with an equal sign and a word, like
this
>>     
>
> Would anyone be into a patch that changed the test from
"While it's
> expecting the beginning of a new statement" to
"Anywhere except
> immediately following something that could be construed
as an l-value?"
>
> Also included in this wishlist item would be a warning
when a line following
> a l-value matches /^=w/.
>
> I actually doubt anyone besides myself is routinely
annoyed by this.
>
>
>   

Can you show a use-case where the pod / literate-programming
style
is materially improved ? 

A-priori, Id expect deeply embedded pod to be discussing the
code itself,
for which #comments are more appropriate.


<tangent>

Ive often wanted pod's line-wrap to be controllable - forex

=wrapat 4

    This Indented pod is rewrapped for display,
    in contrast to the current non-wrapping when the pod is
explicitly 
indented.
    Id find this style more readable (in the raw file) than
left-margin pod,
    without sacrificing the wrapping feature.



Re: why is pod not allowed within expressions?
user name
2007-08-22 16:41:58
David Nicol wrote:
> On 8/22/07, Offer Kaye <offer.kayegmail.com> wrote:
>> [...] it's documented. From "perldoc
perlsyn", the section
>> titled "PODs: Embedded Documentation":
>>
>>        Perl has a mechanism for intermixing
documentation with source code.
>> -->   While it's expecting the beginning of a
new statement, <--
>>        if the compiler encounters a line that
>>        begins with an equal sign and a word, like
this
> 
> Would anyone be into a patch that changed the test from
"While it's
> expecting the beginning of a new statement" to
"Anywhere except
> immediately following something that could be construed
as an l-value?"

My fear would be that this would slow down compilation.  I'd
be interested to
see what happens.


> Also included in this wishlist item would be a warning
when a line following
> a l-value matches /^=w/.

Its not a syntax error?


-- 
Whip me, beat me, make my code compatible with VMS!

Re: why is pod not allowed within expressions?
user name
2007-08-26 08:05:07
On 8/23/07, Jim Cromie wrote:
>
> Can you show a use-case where the pod /
literate-programming style
> is materially improved ?
>
> A-priori, Id expect deeply embedded pod to be
discussing the code itself,
> for which #comments are more appropriate.
>

I'm with Jim on this one. If only for
backwards-compatibility's sake.

But I am curious, does anyone know what was chosen for
Perl6? I know
there were a lot of discussions on the "new POD"
for Perl6, I just
don't know the details of what was decided, or if indeed any
final
syntax has been chosen...

Cheers,
-- 
Offer Kaye

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )