Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Daniel Schröer
Am 30.09.2017 19:34 schrieb "Mark Devine" : My most common OC case: initialize attributes at OC time from external input that will be parsed with grammars &/| scrubbed with elaborate conditional tests. Just a shot in the dark without fully understanding the above: maybe

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:56 PM, Timo Paulssen wrote: > *method new* is useful only if you want to take positional parameters for > the .new — the default new you get from *Mu* only accepts named arguments > and passes them on as-is to *self.bless*. They then get passed to every

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread ToddAndMargo
On 10/01/2017 09:17 AM, Brandon Allbery wrote:      (b d) What does the ".succ" do? In this case it's just an example of an expression that wouldn't have worked by normal interpolation (although $v.succ() would have, as I described earlier). succ is short for "successor";

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 1:02 PM, yary wrote: > > I hadn't heard of TWEAK, thought that BUILD was for setting private > attributes and other tasks the object runs to build itself. > IIRC having BUILD overrides default values, so if you want to have those and still adjust things

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:01 AM, ToddAndMargo wrote: > On 09/30/2017 07:59 PM, Brandon Allbery wrote: > >> Inside " " strings, variables like $foo and (simple) expressions >> (described above) will be replaced by their values; and you can use { } to >> insert the result of

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:01 AM, ToddAndMargo wrote: > On 09/30/2017 07:59 PM, Brandon Allbery wrote: > >> parenthesized expression (so, "hi $foo.name " will not >> work (it'll expand '$foo' instead of '$foo.name ') but >> "hi $foo.name

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:32 AM, Richard Hainsworth wrote: > > >> Is English your first Language? I asked this because of your use >>> >> of the word "interpolate", which you used correctly. >> > This is an odd question and comes across as prejudiced. If someone uses a >

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread ToddAndMargo
On 10/01/2017 01:32 AM, Richard Hainsworth wrote: Remember also that Larry Wall - perl's "inventor" - is a linguist, and the use of language in perl6 space in particular reflects that. Hi Richard, Hmm. That does explain its ease of use over other languages. I really liked Perl 5,

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Richard Hainsworth
    4) "interpolating" as it refers to Perl (not math, where you "guess"     what a value is based on values on both sides of you). Replacing something inside a string with the string representation of its value. This sense is also used in documentation for the shell, where you can

Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread ToddAndMargo
On 09/30/2017 07:59 PM, Brandon Allbery wrote: On Sat, Sep 30, 2017 at 10:30 PM, ToddAndMargo > wrote: On 09/30/2017 02:15 PM, Brandon Allbery wrote: Basically: < > is single quotes and treats variables and expressions