Re: Any "note" without the "say"?

2017-09-20 Thread ToddAndMargo

On 09/18/2017 10:23 AM, Andy Bach wrote:

Er, I was referring more to the P5 behaviour of warn() - w/o a newline, 
its output, to stderr, included more info:

$  perl -e 'warn("hi mom")'  > /dev/null
hi mom at -e line 1.

$  perl -e 'warn("hi mom\n")' > /dev/null
hi mom

"note" appears to append a new line and p6 warn appears to always add 
the extra info.  Looking at

https://docs.perl6.org/routine/warn

I see warn is doing even more that.

Thanks.


Very interesting!  It throws an "exception".

Hm. I wonder how that might be used ...


Re: Any "note" without the "say"?

2017-09-18 Thread Andy Bach
> "note" is the same thing as "say", but to the std error:

Er, I was referring more to the P5 behaviour of warn() - w/o a newline, its
output, to stderr, included more info:
$  perl -e 'warn("hi mom")'  > /dev/null
hi mom at -e line 1.

$  perl -e 'warn("hi mom\n")' > /dev/null
hi mom

"note" appears to append a new line and p6 warn appears to always add the
extra info.  Looking at
https://docs.perl6.org/routine/warn

I see warn is doing even more that.

Thanks.

On Fri, Sep 15, 2017 at 3:58 PM, ToddAndMargo  wrote:

> On 09/15/2017 01:48 PM, Andy Bach wrote:
>
>> So "note"
>> $ perl6 -e 'note "hi mom"' > /dev/null
>> hi mom
>>
>> replaces "warn ...\n" or
>>
>> $ perl6 -e 'warn "hi mom\n"' > /dev/null
>> hi mom
>>
>>in block  at -e line 1
>>
>> have I forgotten my p6 newline syntax (again)?
>>
>
>
> Hi Andy,
>
> Oh goody.  I get to help someone for once!
>
> "note" is the same thing as "say", but to the std error:
>
> $ perl6 -e '$*ERR.say: "print to std err";'
> print to std err
>
> $ perl6 -e 'note "print to std err";'
> print to std err
>
> $ perl6 -e 'note "print to std err";' > /dev/null
> print to std err
>
> $ perl6 -e 'note "print ", "to ", "std err";' > /dev/null 2>&1
> 
>
> "2>&1" redirects STDERR to STDOUT.  And, you put it "after"
> the "/dev/null".  It is a "bash" thing.
>
>
> > have I forgotten my p6 newline syntax (again)?
>
> "\n".  It means new line.  Perl takes care of whether or
> not that is a CR-LF or a LF depending on the OS involved.
>
> example:
> $ perl6 -e '$*ERR.print: "print to std err\n";'
> print to std err
>
>
> -T
>
> --
> ~~~
> Serious error.
> All shortcuts have disappeared.
> Screen. Mind. Both are blank.
> ~~~
>



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: Any "note" without the "say"?

2017-09-15 Thread ToddAndMargo

On 09/15/2017 01:54 PM, Brandon Allbery wrote:
On Fri, Sep 15, 2017 at 4:51 PM, ToddAndMargo > wrote:


On 09/15/2017 01:29 PM, Brandon Allbery wrote:

Everyone does at one time :) It's really useful for debugging,
but you generally strip it out of production code.


I saw a business study somewhere (I don't remember where)
that determined that the notes folks doodle into the margins on
working papers are often time more useful than the papers
themselves.  One wonders how much of this happens in Perl!


That'd be comments, actually. Sadly, the same rule doesn't seem to 
apply; programmers are terrible at writing useful comments for the most 
part.


Hi Brandon,

I "LOVE" to program in Top Down.  You have command and execution.
It reads like a contract.  It is harder to write than Stream of
Conscience, but it is insanely easier to maintain.  This is because
the structure makes it even more powerful than comments.  But
you still have to use comments.

The command sections tells you what it happening.  The subs tell
you the nitty-gritty of how.  I learned all this in my Pascal / Modula2
days.  If one is not careful and loves to program in Stream of
Conscience, you can come up with a write only language very quickly.

-T


Re: Any "note" without the "say"?

2017-09-15 Thread ToddAndMargo

On 09/15/2017 01:48 PM, Andy Bach wrote:

So "note"
$ perl6 -e 'note "hi mom"' > /dev/null
hi mom

replaces "warn ...\n" or

$ perl6 -e 'warn "hi mom\n"' > /dev/null
hi mom

   in block  at -e line 1

have I forgotten my p6 newline syntax (again)?



Hi Andy,

Oh goody.  I get to help someone for once!

"note" is the same thing as "say", but to the std error:

$ perl6 -e '$*ERR.say: "print to std err";'
print to std err

$ perl6 -e 'note "print to std err";'
print to std err

$ perl6 -e 'note "print to std err";' > /dev/null
print to std err

$ perl6 -e 'note "print ", "to ", "std err";' > /dev/null 2>&1


"2>&1" redirects STDERR to STDOUT.  And, you put it "after"
the "/dev/null".  It is a "bash" thing.


> have I forgotten my p6 newline syntax (again)?

"\n".  It means new line.  Perl takes care of whether or
not that is a CR-LF or a LF depending on the OS involved.

example:
$ perl6 -e '$*ERR.print: "print to std err\n";'
print to std err


-T

--
~~~
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
~~~


Re: Any "note" without the "say"?

2017-09-15 Thread Patrick R. Michaud
On Fri, Sep 15, 2017 at 04:54:33PM -0400, Brandon Allbery wrote:
> On Fri, Sep 15, 2017 at 4:51 PM, ToddAndMargo  wrote:
> > On 09/15/2017 01:29 PM, Brandon Allbery wrote:
> >> Everyone does at one time :) It's really useful for debugging, but you
> >> generally strip it out of production code.
> >
> > I saw a business study somewhere (I don't remember where)
> > that determined that the notes folks doodle into the margins on
> > working papers are often time more useful than the papers
> > themselves.  One wonders how much of this happens in Perl!
> 
> That'd be comments, actually. Sadly, the same rule doesn't seem to apply;
> programmers are terrible at writing useful comments for the most part.

True, but when programmers do manage to write useful comments, they often turn 
out to be VERY useful.  :)

Pm


Re: Any "note" without the "say"?

2017-09-15 Thread Brandon Allbery
On Fri, Sep 15, 2017 at 4:51 PM, ToddAndMargo  wrote:

> On 09/15/2017 01:29 PM, Brandon Allbery wrote:
>
>> Everyone does at one time :) It's really useful for debugging, but you
>> generally strip it out of production code.
>>
>
> I saw a business study somewhere (I don't remember where)
> that determined that the notes folks doodle into the margins on
> working papers are often time more useful than the papers
> themselves.  One wonders how much of this happens in Perl!
>

That'd be comments, actually. Sadly, the same rule doesn't seem to apply;
programmers are terrible at writing useful comments for the most part.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Any "note" without the "say"?

2017-09-15 Thread ToddAndMargo

On 09/15/2017 01:29 PM, Brandon Allbery wrote:


Thank you for the confirmation.  Searching for
something like this brings up a bazillion Perl 5 hits.

Oh well, neither is "note".  Someone must have
had a special need for it at one time.



Everyone does at one time :) It's really useful for debugging, but you 
generally strip it out of production code.


Hi Brandon,

I saw a business study somewhere (I don't remember where)
that determined that the notes folks doodle into the margins on
working papers are often time more useful than the papers
themselves.  One wonders how much of this happens in Perl!

Perl 6 is an awesome example of Kaisen (constant improvement)
in action.  It is something to behold.  I wish other projects
were 1/10 as responsive!  I will even take 1/20!

-T


Re: Any "note" without the "say"?

2017-09-15 Thread Andy Bach
>
>
> Oh well, neither is "note".  Someone must have
> had a special need for it at one time.
>

> Everyone does at one time :) It's really useful for debugging, but you
generally strip it out of production code.

So "note"
$ perl6 -e 'note "hi mom"' > /dev/null
hi mom

replaces "warn ...\n" or

$ perl6 -e 'warn "hi mom\n"' > /dev/null
hi mom

  in block  at -e line 1

have I forgotten my p6 newline syntax (again)?

On Fri, Sep 15, 2017 at 3:29 PM, Brandon Allbery 
wrote:

> On Fri, Sep 15, 2017 at 4:02 PM, ToddAndMargo 
> wrote:
>
>> On 09/15/2017 12:52 PM, Brandon Allbery wrote:
>>
>>> On Fri, Sep 15, 2017 at 3:48 PM, ToddAndMargo >> > wrote:
>>>
>>> Is there a similar "print" to the STDERR for when
>>> you don't want the cr-lf inserted?
>>>
>>> The hard way:
>>> $*ERR.print: "print to std err\n";
>>>
>>>
>>> That's it. It's not really common enough to deserve something shorter.
>>>
>>
>> Thank you for the confirmation.  Searching for
>> something like this brings up a bazillion Perl 5 hits.
>>
>> Oh well, neither is "note".  Someone must have
>> had a special need for it at one time.
>>
>
> Everyone does at one time :) It's really useful for debugging, but you
> generally strip it out of production code.
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: Any "note" without the "say"?

2017-09-15 Thread ToddAndMargo

On 09/15/2017 12:52 PM, Brandon Allbery wrote:
On Fri, Sep 15, 2017 at 3:48 PM, ToddAndMargo > wrote:


Is there a similar "print" to the STDERR for when
you don't want the cr-lf inserted?

The hard way:
$*ERR.print: "print to std err\n";


That's it. It's not really common enough to deserve something shorter.


Thank you for the confirmation.  Searching for
something like this brings up a bazillion Perl 5 hits.

Oh well, neither is "note".  Someone must have
had a special need for it at one time.

If its helps others, this is my notes on STDERR:




Perl6: print to STDERR:

$ perl6 -e '$*ERR.print: "print to std err\n";'
print to std err

$ perl6 -e '$*ERR.say: "print to std err";'
print to std err

$ perl6 -e '$*ERR.say: "print ", "to ", "std err";'
print to std err

note: is say that prints to the STDERR
$ perl6 -e 'note "print ", "to ", "std err";'
print to std err

use Terminal::ANSIColor;  # qx[ color ];
sub PrintRedErr ( $Str ) { $*ERR.print: color('bold'), color('red'), 
"$Str", color('reset'); }


Re: Any "note" without the "say"?

2017-09-15 Thread Brandon Allbery
On Fri, Sep 15, 2017 at 3:48 PM, ToddAndMargo  wrote:

> Is there a similar "print" to the STDERR for when
> you don't want the cr-lf inserted?
>
> The hard way:
> $*ERR.print: "print to std err\n";
>

That's it. It's not really common enough to deserve something shorter.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Any "note" without the "say"?

2017-09-15 Thread ToddAndMargo

Hi All,

Thanks to the guys on the chat line, I found out about
"note", which is "say" to the STDERR.

Is there a similar "print" to the STDERR for when
you don't want the cr-lf inserted?

The hard way:
$*ERR.print: "print to std err\n";

Many thanks,
-T