Re: a `pe4rl6 -c` error to fix

2018-06-21 Thread ToddAndMargo

On 06/21/2018 08:42 AM, Larry Wall wrote:

On Wed, Jun 20, 2018 at 10:58:01PM -0700, Brent Laabs wrote:
: -c does compile time warnings, not runtime warnings.  You can't make
: runtime warnings appear at compile time without using a BEGIN block.

That's perhaps a bit oversimplified, since in this case the warning is
coming out of the optimizer, which is post parser, but pre-runtime.  We
could conceivably stop the -c after the optimizer is run.

Larry




That would be sweet!


Re: using run

2018-06-21 Thread Theo van den Heuvel




Hi Brad,

Ha. Now that is exactly what I was looking for. It felt a bit clumsy 
having to first collect the material in a string and then print that 
string.

This is nice.

Thanks,

Theo

Brad Gilbert schreef op 2018-06-21 19:47:

:out can take an argument


...


my $fh = open 'foo.txt', :w;
run 'echo', 'foo bar baz', :out($fh);
close $fh;


-


Re: using run

2018-06-21 Thread Brad Gilbert
:out can take an argument

On Wed, Jun 20, 2018 at 10:32 AM Theo van den Heuvel
 wrote:
>
> Hi all,
>
> trying to make sense of the documentation on run:
> https://docs.perl6.org/routine/run.
> In particular the last part. I don't  understand the adverbs :out and :
> err there.
> Can I set it up so that the output is piped into a file directly? If so
> how would I write that?
>
> I know I could use shell for that, but I doubt that is necessary.
>
> [On first reading I found the doc confusing because it start with a
> hairy example. WHy would anyone wish to write to a file named
> '>foo.txt'? How can that be the first example?]
>

my $fh = open 'foo.txt', :w;
run 'echo', 'foo bar baz', :out($fh);
close $fh;


Re: a `pe4rl6 -c` error to fix

2018-06-21 Thread Larry Wall
On Wed, Jun 20, 2018 at 10:58:01PM -0700, Brent Laabs wrote:
: -c does compile time warnings, not runtime warnings.  You can't make
: runtime warnings appear at compile time without using a BEGIN block.

That's perhaps a bit oversimplified, since in this case the warning is
coming out of the optimizer, which is post parser, but pre-runtime.  We
could conceivably stop the -c after the optimizer is run.

Larry


Re: a `pe4rl6 -c` error to fix

2018-06-21 Thread JJ Merelo
> > On Wed, Jun 20, 2018 at 9:59 PM, Todd Chester 
> What is a BEGIN block?


BEGIN is one of the "phasers" that are used in Perl 6
https://docs.perl6.org/language/phasers#index-entry-Phasers__BEGIN-BEGIN

It marks a block of code for running as soon as possible, and if possible
during compile time. It runs only once. It's in the first phase of the
interpretation of a script, so it runs before any execution (or any
execution phaser) takes place. Execution order is shown here:
https://docs.perl6.org/language/phasers#Execution_Order

Cheers

-- 
JJ


Re: a `pe4rl6 -c` error to fix

2018-06-21 Thread Todd Chester




> wrote:



> On Tue, Jun 19, 2018 at 10:50 PM, Todd Chester mailto:toddandma...@zoho.com>> wrote:
>> Dear Perl Developers,
>>
>> Would you please fix this `perl6 -c` checker error?
>>
>> $ perl6 -v
>> This is Rakudo version 2018.05 built on MoarVM version 2018.05
>> implementing Perl 6.c.
>>
>>
>> The checkers passes this line with Syntax OK
>>
>>   $ReturnStr, $CurlStatus = CurlDownloadFile $FileAddr, 
$BaseFileName,
>> %MaxTime<'MaxTime4'>;
>>
>>
>> But actually running the line throws
>>
>>   Useless use of $ReturnStr in sink context
>>
>>
>> The checker should throw an error if the line is "useless"
>>
>> Many thanks,
>> -T


> On 06/20/2018 11:46 AM, Will Coleda wrote:

It's a warning, not an error.


Indeed it is.  "-c" does warnings too and it should
show in "-c" too.





On 06/20/2018 10:58 PM, Brent Laabs wrote:
-c does compile time warnings, not runtime warnings.  You can't make 
runtime warnings appear at compile time without using a BEGIN block.


On Wed, Jun 20, 2018 at 9:59 PM, Todd Chester 

What is a BEGIN block?