»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
AlexDaniel | Juerd: yea. If they want to keep opening issues, then perhaps they should also write code to resolve some of them | 00:00 | |
Juerd | They are beautifully labeled, though. | ||
00:00
cdg joined
|
|||
AlexDaniel | I'm running out of colors :) | 00:01 | |
Juerd | Doesn't matter, it looks very professional | ||
00:02
Cabanossi left
00:03
Cabanossi joined,
wamba joined
00:04
cdg_ left
00:05
cdg left
|
|||
Geth | whateverable: 9a8b269474 | (Aleks-Daniel Jakimenko-Aleksejev)++ | t/lib/Testable.pm6 Add missing mkdir In case it does not exist yet (e.g. fresh install). |
00:17 | |
whateverable: d5fc45d357 | (Aleks-Daniel Jakimenko-Aleksejev)++ | t/lib/Testable.pm6 Use consistent logfile names We use filenames like “unicodable_2017-09-19_0117.log” for regular log files, so let's use a similar format for other files (this format may be LTA, but consistency first). |
|||
AlexDaniel | Juerd: well, if you like it… maybe you can help? 😍 | 00:22 | |
Zoffix | AlexDaniel: do you remember what you meant here by "Bools aren't tested"? rt.perl.org/Ticket/Display.html?id...xn-1453512 | 00:24 | |
AlexDaniel | Juerd: I can give you ssh access to the machine with bots and do a quick tutorial on how to hack them | ||
Zoffix: okay… hmmm… I think I see | 00:26 | ||
Zoffix: I was talking about things like a => True and a => False | |||
whether this comment makes sense or not I'm not sure | |||
but that's what I meant | 00:27 | ||
Zoffix | ok | ||
AlexDaniel | m: say (a=>False,3).perl | ||
camelia | (:!a, 3) | ||
AlexDaniel | m: say (a=>True,3).perl | ||
camelia | (:a, 3) | ||
AlexDaniel | m: say (:!a,3).perl | ||
camelia | (:!a, 3) | ||
AlexDaniel | m: say (:a,3).perl | ||
camelia | (:a, 3) | ||
00:28
kyan joined
|
|||
AlexDaniel | Zoffix: I guess this includes :a and :!a which is what the OP is about | 00:28 | |
Juerd | AlexDaniel: Thanks for the offer. Unfortunately I can't. | 00:29 | |
I'm afraid basically all I get around to, regarding Perl 6, is reading the weeklies. | |||
kyan | Zoffix: Sorry to bother you again, but I was wondering, when you mentioned earlier that '`$fail === "f"` is better written as `$fail eq "f"`', I noticed that the suggested version gives a warning if $fail is not defined (it's an optional parameter). Should I test and conditionally explicitly set it to "" if it's unset, and then use eq? | 00:30 | |
Zoffix | kyan: I'd just set the default to an empty string: sub foo ($fail = "") {} | 00:32 | |
kyan: basically `===` is an object identity test, while `eq` tests stringy equality | |||
kyan | Zoffix: Ah, cool, thanks! | ||
Zoffix | kyan: will $fail only ever have one value? If so, I'd just have it as a bool named parameter | ||
kyan | (different copies of the same string are the same object?) | 00:33 | |
Zoffix | m: sub foo (:$fail) { if $fail { say "has fail" } else { say "no fail" }; foo :fail; foo | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3} else { say "no fail" }; foo :fail; foo7⏏5<EOL> expecting any of: statement end statement modifier statement modifier loop |
||
Zoffix | m: sub foo (:$fail) { if $fail { say "has fail" } else { say "no fail" } }; foo :fail; foo | ||
camelia | has fail no fail |
||
kyan | ...That's a good idea I hadn't thought of. The bash "everything is a string" philosophy is thoroughly embedded in me, it seems | ||
Thanks! :) | |||
Zoffix | kyan: yeah, they are, but the intent of the test is less clear with `===` because all ideomatic code would use `eq` for stringy equality | 00:34 | |
m: say "foo" === "foobar".substr: 0, 3 | 00:35 | ||
camelia | True | ||
kyan | cool. | ||
Juerd | Most of the time when you get 42, and you wanted "42", you just want to continue because it'll stringify as "42" just fine. | ||
00:36
geekosaur left,
pilne joined
|
|||
kyan | If I declare the param as Str $foo, it will get mad at the caller if it gives it a number, though, right? | 00:36 | |
Zoffix | kyan: right | 00:37 | |
Juerd | Yes, but you could declare it as Str() $foo, and it'll happily coerce things for you | ||
Whether you'd want to do that depends on the use case. If you're just going to display the string, you probably don't really care about type safety. If you're going to build JSON from it, you might. | 00:38 | ||
kyan | Mm, I see. Cool, thanks! | ||
00:43
geekosaur joined
|
|||
AlexDaniel | Juerd: That's OK, thanks anyway :) | 00:43 | |
00:43
troys is now known as troys_
|
|||
AlexDaniel | Juerd: FWIW I'd love to see you during the squashathon (in two weeks). Nowadays I don't have lots of time too, but squashathons are fun | 00:47 | |
Juerd: (pssst, there's free virtual pizza) | 00:48 | ||
00:58
skids left,
cognominal left
00:59
cognominal joined
01:02
mcmillhj left,
skids joined
01:21
geekosaur left
01:29
geekosaur joined
01:35
itaipu joined
01:48
ilbot3 left
01:49
eliasr left
01:52
astj left
01:53
astj joined,
rngoodn joined,
astj left,
astj joined
01:54
ilbot3 joined,
ChanServ sets mode: +v ilbot3
02:00
astj left
02:01
astj joined
02:02
Cabanossi left
02:03
Cabanossi joined
02:04
astj left
|
|||
skids | .tell Zoffix fail.rakudo.party seems to list some "deleted" tickets, e.g. 131808 | 02:05 | |
yoleaux | skids: I'll pass your message to Zoffix. | ||
02:06
astj joined
02:08
astj left
02:09
astj joined
02:11
astj left,
astj joined
|
|||
AlexDaniel | .tell MasterDuke I think you were interested in this stuff: github.com/rakudo/rakudo/pull/1168 | 02:14 | |
yoleaux | AlexDaniel: I'll pass your message to MasterDuke. | ||
02:29
AlexDani` joined
02:31
AlexDaniel left
02:32
astj left
02:33
zakharyas joined
02:43
cpage_ left,
geekosaur left
02:44
cpage_ joined,
geekosaur joined
02:45
rngoodn left
|
|||
skids | r-j: class A { has str $.x; method BUILD(:$!x) { } }; say A.new(:x<foo>).x | 02:47 | |
camelia | Error while reading '/home/camelia/p6eval-token': No such file or directory at /home/camelia/rakudo-j-inst/bin/eval-client.pl line 10. | ||
02:47
Cabanossi left
02:48
Cabanossi joined
02:57
noganex joined
03:00
noganex_ left
|
|||
MasterDuke | AlexDani`: thanks, i hadn't seen that | 03:07 | |
yoleaux | 02:14Z <AlexDaniel> MasterDuke: I think you were interested in this stuff: github.com/rakudo/rakudo/pull/1168 | ||
03:07
AlexDani` is now known as AlexDaniel,
rngoodn joined
03:08
skids left
03:13
itaipu left
03:14
piojo joined,
piojo_ left
03:20
itaipu joined
03:22
pilne left
03:27
itaipu left
03:30
Cabanossi left
03:32
Cabanossi joined
03:34
astj joined
03:38
troys_ is now known as troys
03:48
tardisx joined,
astj left
03:49
astj joined,
astj left,
astj joined
03:59
khw left
04:04
aborazmeh joined,
BenGoldberg left
04:05
aborazmeh left,
aborazmeh joined
04:10
rngoodn left
04:13
rngoodn joined
04:23
cdg joined
04:28
AlexDaniel left,
cdg left
04:43
troys is now known as troys_
04:44
astj left,
astj joined
04:45
astj left,
astj joined
04:46
Cabanossi left
04:47
astj left,
Cabanossi joined
04:55
llfourn joined
04:57
mr-fooba_ joined
04:59
astj joined,
mr-foobar left
05:00
troys_ is now known as troys
05:14
knobo joined
05:19
ufobat joined
05:24
vendethiel- joined
05:25
Ven`` left
05:35
kyan left
05:37
troys left
05:39
rngoodn left
05:43
wamba left
05:45
Cabanossi left
05:47
Cabanossi joined
05:53
cpage_ left
05:59
andrzejku left
06:02
domidumont joined
06:08
domidumont left,
domidumont joined
06:15
nadim joined
|
|||
grondilu | m: for <foo>.Mix.pairs X <bar>.Mix.pairs -> ($a, $b) { say "$a, $b" } | 06:18 | |
camelia | Too few positionals passed to ''; expected 2 arguments but got 0 in sub-signature in block <unit> at <tmp> line 1 |
||
06:18
eliv joined
|
|||
grondilu | ^not sure what I'm doing wrong here | 06:18 | |
m: for <foo>.Mix.pairs X <bar>.Mix.pairs -> $a, $b { say "$a, $b" } | |||
camelia | Too few positionals passed; expected 2 arguments but got 1 in block <unit> at <tmp> line 1 |
||
06:18
eliv left
06:20
andrzejku joined
06:31
darutoko joined
06:35
wamba joined
06:39
cdg joined
06:41
eliv joined
06:42
eliv left
|
|||
grondilu | m: for :a X :b -> ($i, $j) { say "$i $j" } | 06:43 | |
camelia | Too few positionals passed to ''; expected 2 arguments but got 0 in sub-signature in block <unit> at <tmp> line 1 |
||
06:43
robertle left
|
|||
grondilu | m: for :a X :b -> $i, $j { say "$i $j" } | 06:43 | |
camelia | Too few positionals passed; expected 2 arguments but got 1 in block <unit> at <tmp> line 1 |
||
grondilu | wth | ||
m: for <a> X <b> -> ($i, $j) { say "$i $j" } | 06:44 | ||
camelia | a b | ||
06:44
cdg left
|
|||
moritz | I guess X doesn't expect named arguments, but rather positional ones | 06:44 | |
grondilu | m: for (:a,) X (:b,) -> $i, $j { say "$i $j" } | ||
camelia | Too few positionals passed; expected 2 arguments but got 1 in block <unit> at <tmp> line 1 |
||
grondilu | m: for (:a,) X (:b,) -> ($i, $j) { say "$i $j" } | ||
camelia | Too few positionals passed to ''; expected 2 arguments but got 0 in sub-signature in block <unit> at <tmp> line 1 |
||
06:45
aborazmeh left
|
|||
grondilu | m: for [:a] X [:b] -> ($i, $j) { say "$i $j" } | 06:45 | |
camelia | Too few positionals passed to ''; expected 2 arguments but got 0 in sub-signature in block <unit> at <tmp> line 1 |
||
grondilu | jeez | ||
m: for $:a X $:b -> ($i, $j) { say "$i $j" } | 06:46 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Cannot use placeholder parameter $:a outside of a sub or block at <tmp>:1 ------> 3for $:a7⏏5 X $:b -> ($i, $j) { say "$i $j" } |
||
grondilu | meh | ||
06:46
cpage_ joined
06:47
ken2 joined
06:48
eliv joined
06:51
araujo left
06:52
piojo left
06:53
araujo joined,
araujo left,
araujo joined
06:54
raschipi joined,
nadim left
07:03
setty1 joined
07:12
llfourn_ joined
07:15
llfourn left
07:24
rindolf joined
07:33
ponbiki left
07:34
ponbiki joined
07:46
Cabanossi left
07:47
Cabanossi joined
07:56
Ven`` joined,
vendethiel- left
08:01
imcsk8 left,
imcsk8 joined
08:04
mithaldu_ left,
leont joined,
Praise left,
jantore left,
mithaldu_ joined,
tony-o left
08:05
jantore joined,
awwaiid left,
wamba left,
huf left,
Praise joined,
Praise left,
Praise joined,
wamba joined
08:06
mtj_ left,
gfldex left,
huf joined,
gfldex joined,
xinming left,
tokik left,
tony-o joined,
awwaiid joined
08:07
ChoHag left,
raschipi left
08:08
tokik joined,
aindilis left,
ChoHag joined,
jcallen_ joined,
jcallen left
08:11
aindilis joined
08:14
xinming joined
08:20
mtj_ joined
08:24
vendethiel- joined
08:25
Ven`` left,
fluca1978 joined
|
|||
fluca1978 | I have a doubt about "is rw" class member access: class Foo { has $.bar is rw; } | 08:26 | |
tyil | has `set()` from Bailador changed? | ||
fluca1978 | Foo.new.bar = 'Hello'; is this an lvalue method call or a variable access? | 08:27 | |
moritz | Foo.new.bar returns a so-called "container" | ||
and = assigns a value to it | |||
which only works if method bar returns a writable container | 08:28 | ||
(and container sits between variable (which is a syntactic element) and the value) | |||
fluca1978 | moritz: so it is like a container is a reference to the variable within the object instance, something alike? | 08:29 | |
moritz | fluca1978: it's the other way round | 08:30 | |
a variable contains a reference to a container | |||
08:30
leont left
|
|||
moritz | and when you assign to a variable, you update the value that's stored in the container | 08:30 | |
fluca1978 | moritz: therefore "bar" points (allow me the term) to a container, and each time Foo::bar is called such container is returned. the variable therefore is a kind of refence itself, right? | 08:31 | |
moritz | fluca1978: yes | 08:32 | |
(with the small caveat that the method isn't Foo::bar; that would be a subroutine) | |||
ufobat | tyil, nope, do you have any problems? | 08:33 | |
fluca1978 | moritz: is this true only for classes variables or for any variable in Perl 6? | ||
moritz | fluca1978: for all variables | 08:34 | |
tyil | ufobat: set() doesnt seem to actually set anything in my latest script, yet it works as expected in an older project of mine | ||
if I `set("host", "127.1")` it still hosts on 0.0.0.0 | |||
fluca1978 | moritz:thanks a lot | 08:35 | |
tyil | ufobat: also, trying to set `config.host = "127.1"` results in undeclared routine | 08:36 | |
(yes, I have `use Bailador`) | 08:37 | ||
ufobat | [~/.workspace/p6/Bailador] - [Fr Sep 22, 10:37] | ||
└─[$] <git:(dev*)> perl6 -Ilib -e 'use Bailador; set("host", "127.1.2.3"); dd config.host' | |||
Str $!host = "127.1.2.3" | |||
do you have a older version installed? i tested it against "dev" | 08:38 | ||
i also tested it against 0.0.12 | |||
08:40
cdg joined,
robertle joined
|
|||
tyil | I though I was on 0.0.12 too, zef upgrade Bailador seems to fail with "o such method 'dist' for invocant of type 'Any'. Did you mean any of these?" | 08:42 | |
ufobat | --verbose, maybe? | 08:43 | |
08:44
cdg left
|
|||
tyil | that doesnt give more output than before | 08:45 | |
just some suggestions and a backtrace | |||
ufobat | does the backtrace help? i dont know what's wrong :( | 08:46 | |
tyil | idk either | ||
I'll try a zef install --force Bailador see if that helps anything | 08:47 | ||
===> Fetching [FAIL]: Bailador:ver('0.0.12') from git://github.com/Bailador/Bailador.git | |||
welp | |||
ufobat | i dont know how verions and github work, Bailador is also on cpan. on my box zef takes it from there | 08:50 | |
===> Found: Bailador:ver<0.0.12> [via Zef::Repository::Ecosystems<cpan>] | |||
08:50
fluca1978 left
|
|||
tyil | ugh, I'll take a look at it again at a later date | 08:58 | |
09:13
lowbro joined,
lowbro left,
lowbro joined
09:25
piojo joined
09:28
gfldex_work joined
09:31
eliasr joined
09:32
gfldex_work left
09:44
wamba left
09:46
Cabanossi left
09:47
Cabanossi joined
09:52
dustinm` left
09:56
wamba joined
09:57
dustinm` joined
09:59
margeas joined
10:01
TEttinger left
10:07
zakharyas left,
zakharyas joined
10:08
astj left
10:11
zakharyas left
|
|||
Zoffix | . | 10:17 | |
yoleaux | 02:05Z <skids> Zoffix: fail.rakudo.party seems to list some "deleted" tickets, e.g. 131808 | ||
Zoffix | yes it does | ||
10:19
hkaimenas joined
|
|||
Zoffix | RT's API doesn't report deletions as status changes, so unless you fetch the thousand+ of tickets (slow as hell), you keep the deleted | 10:19 | |
(and yes, there's a way to toss deletions by, say, fetching the 1000+ tickets every 24 hours, but I haven't had the time to code that: github.com/zoffixznet/r6 ) | 10:25 | ||
10:36
jonas1 joined
|
|||
mspo | did 09 come out? | 10:40 | |
rakudo.org has stalled in blog posts | 10:41 | ||
oh maybe not | 10:42 | ||
Zoffix | mspo: yes, but compiler releases are only announced on the compiler mailing list. There's no .09 Rakudo Star | 10:43 | |
mspo | oh there's a moar 09.1 | ||
Zoffix | huggable: debs | ||
huggable | Zoffix, CentOS, Debian, Fedora and Ubuntu Rakudo packages: github.com/nxadm/rakudo-pkg/releases | ||
Zoffix | huggable: star | 10:51 | |
huggable | Zoffix, Estimated Rakudo Star releases for 2017: .01, .04, .07 & .10 | ||
11:00
eliv left
11:01
itaipu joined
11:03
eliv joined
11:14
skids joined
11:18
hkaimenas left
11:20
skids left
11:21
wamba left
11:23
piojo left
11:26
rgrau joined
11:31
Cabanossi left
11:32
Cabanossi joined
11:34
cdg joined
11:39
cdg left
11:48
vendethiel- left,
llfourn_ left
11:52
ShalokShalom_ joined
11:53
domidumont left
11:54
domidumont joined
11:55
ShalokShalom left
11:59
ken2 left
12:01
ken2 joined
12:07
eliv left,
eliv joined
12:10
eliv left
12:11
eliv joined
12:12
piojo joined
12:24
rngoodn joined
12:25
wamba joined
12:30
Cabanossi left
12:32
Cabanossi joined
12:35
n0tjack joined
|
|||
n0tjack | We're having a mini idiom showcase in our language nerd channel at work ... what's the prettiest and most idiomatic way to express the volume of a N-ball in Perl6? That is, pi^(n/2) / gamma(n/2 - 1) where gamma is the generalized factorial? | 12:37 | |
DrForr | Well, Gamma(1/2-n)=(pi**1/2)/((n**-1/2)*(n!) and of course Gamma(1/2)=pi**(1/2) | 12:42 | |
12:45
ken2 left,
ken1 joined
|
|||
TimToady | see also rosettacode.org/wiki/Gamma_function#Perl_6 | 12:45 | |
n0tjack | oh, nice | ||
just what I needed, thanks guys | |||
TimToady: what's with the constants in that function? Just for faster convergence? Why not a closed form function? | 12:48 | ||
TimToady | rakudo doesn't always do things quite at the right time for that yet | 12:50 | |
12:51
eliv left,
ken1 is now known as thunktone
12:52
reu left
|
|||
n0tjack | does p6 have a polynomial application function which takes a series of coefficients and produces the sum of the product of those coefficients with successively greater powers of a value, or should I roll my own with [+] and Z* ? | 12:53 | |
12:53
wamba left
|
|||
DrForr | Maybe polymod does what you're after? | 12:54 | |
TimToady | that's the other direction | 12:55 | |
timotimo | so polyproduct :) | ||
perlpilot | There's rosettacode.org/wiki/Horner%27s_rul...ion#Perl_6 | ||
TimToady | m: say :10[4,3,2,1] | 12:57 | |
camelia | 4321 | ||
TimToady | maybe that, or the function under it | ||
12:57
cdg joined
|
|||
n0tjack | whoa, [o] is cool | 12:59 | |
never thought of that | |||
perlpilot | Maybe someone needs to write a short-ish "Perl 6 for Mathematicians" or something | 13:00 | |
:-) | |||
TimToady | I guess the underlying function as the un-pretty name of &UNBASE_BRACKET | ||
*has | |||
13:02
skids joined,
ShalokShalom_ is now known as ShalokShalom
13:04
cdg_ joined,
HoboWithAShotgun joined
|
|||
HoboWithAShotgun | good afternoon you lovely people | 13:05 | |
Zoffix | \o | 13:06 | |
n0tjack | perlpilot: I think a Perl6 module for generating OEIS sequences, including recipes and idioms for common patterns is a worthwhile exercise | 13:07 | |
13:08
cdg left
|
|||
n0tjack | I may never get around to it | 13:08 | |
but it's a neat idea | |||
13:09
geekosaur left
|
|||
HoboWithAShotgun | the docs say this would be nyi | 13:10 | |
m: my &s = sub (Int $a where * < 0) { say $a; }; &s(-1); | |||
camelia | -1 | ||
timotimo | what part of it? | ||
HoboWithAShotgun | docs.perl6.org/type/Callable | 13:11 | |
the anonymous signature | |||
or closure with signature | |||
Zoffix | HoboWithAShotgun: the one with `my &f:(Int)` parts? | ||
HoboWithAShotgun | yup | ||
Zoffix | m: my &s:(Int) = sub (Int{ say $a; }; &s(-1); | 13:12 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> You can't adverb &s at <tmp>:1 ------> 3my &s:(Int)7⏏5 = sub (Int{ say $a; }; &s(-1); |
||
13:12
mcmillhj joined
|
|||
HoboWithAShotgun | nevermind i overlooked the :(Int) part | 13:12 | |
:-/ | |||
13:16
mr-foobar joined
13:17
mr-fooba_ left
|
|||
Geth | doc: 3ecad59a15 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Socket/INET.pod6 Use constants for sock family |
13:17 | |
13:19
geekosaur joined
|
|||
Zoffix | .oO( 🎜 🎝 We—Are—Faaaamilyyyy ) |
13:20 | |
DrForr | Hopefully the package name isn't ClothesDryer. | 13:21 | |
Zoffix | huh, PF_INET isn't a constant, it's an enum, yet they're constants here: github.com/rakudo/rakudo/blob/nom/....pm#L3-L18 | 13:22 | |
Zoffix bets there's a duplicate set of enums somewhere | |||
Yup :( github.com/rakudo/rakudo/blob/nom/...pm#L11-L17 | 13:23 | ||
eater | those are also wrong D: | ||
13:27
gregf_ left
|
|||
HoboWithAShotgun | i just learned that say 2.&g.&f; and say f( g(3) ); is equivalent, but why? i mean the functions clearly are not methods of some Int | 13:27 | |
2 and 2, not 2 and 3 | 13:28 | ||
Zoffix | HoboWithAShotgun: $foo.&g($bar) is equivalent to g($foo, $bar) | ||
moritz | it's just a syntactic construct to invoke a subroutine | 13:29 | |
Zoffix | (more or less; there seem to be differences that mess with the Failures; there's a ticket for it) | ||
HoboWithAShotgun | ah, i see. | ||
m: class foo { sub bar( $self ) { $self.baz }; sub baz { say "hi" } }; foo.new.bar; | 13:30 | ||
camelia | No such method 'bar' for invocant of type 'foo' in block <unit> at <tmp> line 1 |
||
HoboWithAShotgun | allright, but assuming the dot would resolve then this would work | 13:31 | |
Zoffix | HoboWithAShotgun: subs are lexical by default. Also, you're missing the `&` | 13:32 | |
m: class foo { our sub bar( $self ) { $self.baz }; sub baz { say "hi" } }; foo.new.&bar; | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: bar used at line 1. Did you mean 'VAR', 'bag'? |
||
Zoffix | hmmm | ||
oh | |||
Well, not oh, but I see `&` is also missing on baz... Weird it's saying bar is undeclared tho | 13:33 | ||
13:33
reu joined
|
|||
Zoffix | m: class foo { sub bar( $self ) is export { $self.&baz }; sub baz ($) { say "hi" } }; import foo; foo.new.&bar; | 13:34 | |
camelia | hi | ||
Zoffix | hm, there's something I don't understand about symbols :/ | ||
HoboWithAShotgun | dont bother. this was just to see wether i got that first argument thing right in my head | ||
Zoffix | I still want to know what I missing :) | ||
m: class { our sub foo { 42.say } }; foo | 13:35 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: foo used at line 1 |
||
Zoffix | I thought `our` would make `foo` available where I'm calling it | ||
m: class Foo { our sub foo { 42.say } }; Foo::foo | 13:36 | ||
camelia | 42 | ||
Zoffix | There's the missing piece :D | ||
moritz | m: class { our sub foo { 42.say }.WHO | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3class { our sub foo { 42.say }.WHO7⏏5<EOL> expecting any of: statement end statement modifier statement modifier loop |
||
moritz | m: class { our sub foo { 42.say }}.WHO | ||
camelia | ( no output ) | ||
moritz | m: class { our sub foo { 42.say }}.WHO<&foo> | ||
Zoffix | m: class Foo { our sub bar( $self ) { $self.&baz }; sub baz ($) { say "hi" } }; Foo.new.&Foo::bar; | ||
camelia | ( no output ) | ||
hi | |||
moritz | m: class { our sub foo { 42.say }}.WHO<&foo>() | ||
camelia | 42 | ||
Zoffix | :) | ||
moritz | that's how you can call an our-sub from an anonymous package | ||
Zoffix | Neat | 13:37 | |
moritz | though why anybody would put an our-sub into an anon class is anybody's guess :-) | ||
HoboWithAShotgun | nevertheless it is covered | ||
which probably tells us something | 13:38 | ||
moritz | that jnthn++ designed the types and package table system really well? :-) | 13:39 | |
HoboWithAShotgun | this pony tailed late hippy, yeah | ||
i love his talks | |||
13:41
mephinet joined,
piojo left
|
|||
HoboWithAShotgun | when he talks, there is this hint of pride in his voice, yet he is too humble to show it :-) | 13:41 | |
fully i mean | |||
13:42
mr-fooba_ joined,
piojo joined
13:43
mr-foobar left
|
|||
HoboWithAShotgun | speaking of talks, did you guys watch damians "three little words"? | 13:44 | |
13:45
Cabanossi left
13:47
Cabanossi joined
13:59
HoboWithAShotgun left
14:01
thunktone left
14:03
thunktone joined
14:21
itaylor57 left,
HoboWithAShotgun joined,
itaylor57 joined
14:28
nekomune joined
14:30
geekosaur left
14:31
Cabanossi left,
lowbro left
14:32
khw joined,
wander4096 joined,
Cabanossi joined
|
|||
wander4096 | can i just compile p6-code but not execute it? | 14:35 | |
like when works on java, it is separated into `javac` and `java` | |||
i want to do `rakudo-c`, not the whole `perl6 ...` | 14:36 | ||
14:37
geekosaur joined
|
|||
DrForr | You might be able to use --target= in order to just do the precompile. | 14:40 | |
I don't see any other options in the main perl6 binary, though there's also a -o that might aid in things. | 14:41 | ||
wander4096 | i try this command `perl6 main.p6 --target=jvm` | ||
it just runs the code | |||
14:42
piojo left
|
|||
wander4096 | no files look like bytecode file generated | 14:42 | |
DrForr | Right, --target accepts a compilation stage, probably not the VM to compile against. | ||
jnthn | I'd have to be --target=jar --output=SomeFile.jar I guess | ||
Though I don't know if it will produce something that will run directly | 14:43 | ||
wander4096 | it seems that -o option has no effect | 14:44 | |
14:44
piojo joined
|
|||
wander4096 | run `perl6 main.p6 -o=main` but file `main` wasn't generated | 14:45 | |
DrForr | That may not be the intent of the -o option, I was simply reading the output of 'perl6 -h'. | 14:46 | |
14:46
HoboWithAShotgun left
15:01
Cabanossi left
15:02
Cabanossi joined,
cdg_ left
15:03
Sgeo_ joined,
cdg joined
15:05
Sgeo left
15:06
cdg_ joined
|
|||
nekomune | i'm having trouble figuring out how i can pass an array as an argument to a function expecting a NativeCall Pointer argument. | 15:06 | |
is there a way I can reference this array through a pointer? | 15:07 | ||
15:08
cdg left
15:09
troys joined
15:12
wander4096 left
15:13
mcmillhj left
|
|||
ugexe | wander4096: its `perl6-j --target=jar --output=SomeFile.jar main.p6`. but you still need a perl6 entry point to run it i believe | 15:14 | |
before you were running your main.p6 script and passing the script itself the -o=main | 15:17 | ||
Zoffix | nekomune: don't know anything about NativeCall, but I see a section on Arrays in the docs. Perhaps that'll be of help: docs.perl6.org/language/nativecall#Arrays | 15:37 | |
15:37
mcmillhj joined
|
|||
nekomune | Zoffix: If I use NativeCall's CArray instead, I would still get something like: expected NativeCall::Types::Pointer but got Array ($[NativeCall::Types::...) | 15:40 | |
Zoffix | No idea, sorry. | ||
nekomune | np, i'll still try to figure this out. | 15:41 | |
15:42
Aaronepower joined
|
|||
nekomune | I've seen docs.perl6.org/language/nativecall...f_Pointers as well, but it only goes into dealing with pointers returned from a native call. | 15:42 | |
there's even a helper function 'nativecast' | |||
but not much about the other way around... | |||
15:43
gregf_ joined
|
|||
Aaronepower | Hello, is there a way to use Grammars? Like call another grammar as part of a rule? | 15:43 | |
re use* | |||
15:47
eliv joined
15:48
geekosaur left,
cdg_ left
15:49
domidumont left,
cdg_ joined,
geekosaur joined,
cdg_ left
|
|||
perlpilot | m: grammar A { token foo { "foo" } }; grammar B { token TOP { <A::foo> } }; say B.parse("foo"); | 15:49 | |
camelia | 「foo」 A::foo => 「foo」 |
||
15:49
cdg_ joined
15:50
cdg__ joined,
geekosaur left
|
|||
Zoffix | They're just classes. All the same benefits apply. You can even mix in roles | 15:50 | |
m: role A { token foo { "foo" } }; grammar B does A { token TOP { <foo> } }; say B.parse("foo"); | 15:51 | ||
camelia | 「foo」 foo => 「foo」 |
||
15:51
geekosaur joined
|
|||
Aaronepower | Sorry I think I wasn't clear. I don't want to use methods from another grammar I want to call the whole grammar. | 15:52 | |
m: grammar A { token foo { "foo" } }; grammar B { token TOP { <A> } }; say B.parse("foo"); | |||
camelia | No such method 'A' for invocant of type 'B' in regex TOP at <tmp> line 1 in block <unit> at <tmp> line 1 |
15:53 | |
15:53
jonas1 left,
cdg_ left
|
|||
Zoffix | Aaronepower: just use the entry token instead of <A> (so, it'd be <A::TOP> for common case) | 15:54 | |
perlpilot | m: grammar A { token TOP { "foo" } }; grammar B { token TOP { <A::TOP> } }; say B.parse("foo"); | ||
camelia | 「foo」 A::TOP => 「foo」 |
||
Zoffix | .parse just uses TOP as default; it's changeable | 15:55 | |
m: grammar B { token meows { "foo" } }; say B.parse: "foo", :rule<meows>; | |||
camelia | 「foo」 | ||
perlpilot | Aaronepower: so ... why do you want to 'call the whole grammar' from within a rule of another grammar? | ||
Aaronepower | perlpilot: Because I want to call A on it's own as well. | 15:56 | |
15:59
astj joined,
troys is now known as troys_
16:00
Cabanossi left
16:01
geekosaur left,
nadim joined,
robertle left
16:02
Cabanossi joined
16:03
astj left
16:04
eliv left
|
|||
Aaronepower | Is there a way to concat hashs? Like `{foo => 1} + {bar => 2} = {foo => 1, bar => 2}`? | 16:07 | |
16:07
geekosaur joined
|
|||
perlpilot | Aaronepower: what do you want to happen with same-named keys ? | 16:08 | |
Aaronepower | perlpilot: Can't happen in my case. | 16:09 | |
As in there will never be a conflict. | |||
perlpilot | m: my %h = foo => 24; my %g = bar => 42; say %h.push(%g); | 16:10 | |
camelia | {bar => 42, foo => 24} | ||
perlpilot | m: my %h = foo => 24, bar => 87; my %g = bar => 42; say %h.push(%g); | ||
camelia | {bar => [87 42], foo => 24} | ||
perlpilot | (note what happens if there are dups) | ||
16:12
roguelazer left
16:14
HoboWithAShotgun joined
|
|||
perlpilot | Aaronepower: I suppose I should have mentioned the simpler: %x = %h, %g; # :-) | 16:14 | |
16:14
roguelazer joined
|
|||
perlpilot | m: my %h = foo => 24, bar => 87; my %g = bar => 42; my %x = %h, %g; say %h | 16:14 | |
camelia | {bar => 87, foo => 24} | ||
perlpilot | m: my %h = foo => 24, bar => 87; my %g = bar => 42; my %x = %h, %g; say %x | ||
camelia | {bar => 42, foo => 24} | ||
hythm | Hello, I'm trying to use IoC module in another module, but I get Undeclared routine when I' try to use IoC routine. Here is a gist, What I'm doing wrong? gist.github.com/hythm7/aabc37aa540...834380e86f | 16:16 | |
16:17
troys_ is now known as troys
|
|||
perlpilot | hythm: A::IoC doesn't automatically export routines from IoC; | 16:19 | |
Aaronepower | Zoffix: How would I call the Actions object on that grammar? | ||
hythm | perlpilot: is there a way I can tell A::I0C to export them, or it has to be exported in IoC module at first? | 16:20 | |
s/0/o/ | |||
perlpilot | hythm: there's docs.perl6.org/language/modules#in...sub_EXPORT | 16:21 | |
16:21
piojo left,
Sgeo_ left
16:22
jameslenz joined
|
|||
hythm | Thanks perlpilot, checking that | 16:22 | |
perlpilot | hythm: you'll probably have to change lib-A-IoC.pm to no longer use `unit`. | 16:27 | |
16:28
Aaronepower left,
Aaronepower joined
|
|||
perlpilot | hythm: something like: use IoC; sub EXPORT { %(IoC::EXPORT::DEFAULT::); } module A::IoC { sub setup-ioc is export {} } | 16:28 | |
perlpilot is having a sloooow day today | |||
16:29
thunktone left
16:30
thunktone joined
|
|||
Aaronepower | How do you call The Actions object on Grammar inside another grammar? `grammar Foo { token TOP { foo } } class FooActions { method TOP($/) { 1 } } grammar Bar {token TOP { <Foo::TOP> } } class BarActions { method TOP { make $<Foo::TOP>.made } }` | 16:31 | |
hythm | perlpilot: That worked great, thanks. | ||
16:31
domidumont joined
16:32
ufobat left
|
|||
grondilu | m: say Inf ~~ Num; say Inf ~~ Int | 16:33 | |
camelia | True False |
||
grondilu | :/ | ||
Aaronepower | How could have it so `Bar.parse("foo", actions => BarActions).made` returns 1? | ||
grondilu: Inf is a Float no? | |||
grondilu wanted to extend an integer index to infinity with Inf, but learnt that Inf is not an Int | |||
Aaronepower: apparently | |||
16:34
astronavt joined
|
|||
grondilu | I suppose it's the IEEE-754 (IIRC) floating point value or something | 16:34 | |
Aaronepower | grondilu: An Int can only go up to 2147483647. | ||
grondilu | I don't think so | 16:35 | |
no in Perl 6 | |||
*not | |||
an Int is not an int | |||
Zoffix | Inf is a Num | ||
Yeah, we follow IEEE 754-2008 (with some parts yet to be stuffed into 6.d language release) | |||
perlpilot | Aaronepower: I don't think that you do. At least not without calling Foo.parse(…) You'd have to have the Bar grammar slurp up enough of its input to feed to Foo though. | ||
Zoffix | m: say 0/0 | 16:36 | |
camelia | Attempt to divide by zero using div in block <unit> at <tmp> line 1 |
||
grondilu | m: say 1/0 | ||
camelia | Attempt to divide 1 by zero using div in block <unit> at <tmp> line 1 |
||
Zoffix | m: .Num.say for 1/0, -1/0, 0/0 | ||
camelia | Inf -Inf NaN |
||
Zoffix | You need Num view to get IEEE semantics | ||
Aaronepower | perlpilot: Is there no way to pass $<Foo::TOP> to FooActions? | ||
grondilu | Kind of annoying I can't have a version of Inf that is Int :/ | 16:37 | |
Aaronepower | perlpilot: Like in BarActions | ||
grondilu | it would have been elegant in my code | ||
16:38
mcmillhj left
|
|||
grondilu | m: say Inf.Int | 16:38 | |
camelia | Cannot coerce Inf to an Int in block <unit> at <tmp> line 1 |
||
grondilu | :P | ||
Aaronepower | grondilu: It wouldn't really make sense though, as Int isn't supposed to represent entire spectrum of numbers. | 16:39 | |
Zoffix | Yeah. There might be something borne out of it in 6.* release, but last we thought of making Inf an Int and a Num it sounded like a bad idea | ||
grondilu | Aaronepower: it could though, couldn't it? | ||
Zoffix | There are lots of places where an arg could be Int number OR an * (Inf) and just because of that extra condition you can't use a native int (well, without multi dispatch) | 16:40 | |
Well, not can't, but it's extra hassle and extra lost CPU cycles | |||
Aaronepower | grondilu: In the same way that an Int could hold floating point numbers. Int implies a lot about how the number works and how to add and sub from it. | 16:41 | |
grondilu | I suppose I may create a subset of Real | 16:42 | |
m: subset Intish of Real where { $_ ~~ Int or $_ ~~ Inf } | |||
camelia | ( no output ) | ||
perlpilot | Aaronepower: If you were using roles, you could compose the Foo role into the Bar grammar and FooActions role into the BarActions class. | ||
grondilu | m: subset Intish of Real where { $_ ~~ Int or $_ ~~ Inf }; say Inf ~~ Intish | ||
camelia | True | ||
grondilu is not too happy about the name "Intish" though | 16:43 | ||
perlpilot | Aaronepower: and to use Foo stand-alone you'd have to make a FooOnly grammar and a FooActionsOnly class that are empty except for composing the roles | ||
thunktone | Surely you could call it "Integer" if you want? | 16:44 | |
Aaronepower | perlpilot: But Is there no way of saying something like `FooActions.new($<Foo::TOP>)` in the BarActions method? | ||
grondilu | m: say Inf ~~ Real # just checking | ||
camelia | True | ||
grondilu | thunktone: yeah, "Integer" should do | ||
Zoffix | m: say Int.Range | 16:45 | |
camelia | -Inf^..^Inf | ||
16:46
robertle joined
|
|||
Zoffix | m: say int.Range | 16:46 | |
camelia | -9223372036854775808..9223372036854775807 | ||
thunktone | So Int goes up to infinity minus one? | 16:47 | |
perlpilot | Aaronepower: I can't think of one, but my brain power isn't very reliable today for some reason :) | ||
16:47
AlexDaniel joined
|
|||
Zoffix | thunktone: no, it goes up to infinity without including infinity itself | 16:48 | |
m: say Inf - 1; # "minus one" is still infinity | |||
16:48
AlexDaniel left
|
|||
camelia | Inf | 16:48 | |
Zoffix | m: say eager 1.3..^2.5; # the ^ means exclude the endpoint, not minus one, even for non-Inf | 16:49 | |
camelia | (1.3 2.3) | ||
Zoffix | You know what would be a good use for that .Bridge method? It takes an arg and returns appropriate matching arg | 16:50 | |
m: class InfI is Num is Int { method Bridge { 42 } }; say 0e0 + InfI | |||
camelia | 42 | ||
Zoffix | m: class InfI is Num is Int { method Bridge { 42 } }; say 0 + InfI | ||
camelia | 42 | ||
Zoffix | Like here, it'd receive 0 or 0e0 and return appropriate value | ||
16:50
AlexDaniel joined
16:52
lichtkind joined
|
|||
grondilu | m: subset Int∞ of Real where { $_ ~~ Int or $_ ~~ Inf } | 16:52 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus postfix at <tmp>:1 ------> 3subset Int7⏏5∞ of Real where { $_ ~~ Int or $_ ~~ Inf expecting any of: infix infix stopper postfix statement end… |
||
grondilu thought Int∞ would be an allowed identifier for some reason | |||
Zoffix | m: sub infix:<+> { &CORE::infix:<+>($^a, $^b.Bridge: $a) }; class InfI is Num is Int { method Bridge($v) { $v ~~ Int ?? int.Range.max !! Inf } }; say 0e0 + InfI | 16:53 | |
camelia | Inf | ||
Zoffix | m: sub infix:<+> { &CORE::infix:<+>($^a, $^b.Bridge: $a) }; class InfI is Num is Int { method Bridge($v) { $v ~~ Int ?? int.Range.max !! Inf } }; say 0 + InfI | ||
camelia | 9223372036854775807 | ||
Zoffix | Like that | ||
∞ is not a valid identifier | |||
u: ∞ | |||
unicodable6 | Zoffix, U+221E INFINITY [Sm] (∞) | ||
Zoffix | Need a Lu Ll Nd - or ' | 16:54 | |
grondilu | ol | ||
*ok | |||
wasn't it used as an alias for Inf, though? | |||
m: say ∞ | |||
camelia | Inf | ||
Zoffix | Yeah, it's just converted to Inf by the grammar. It's not an idenfier-based term | 16:55 | |
grondilu | ok | ||
wasn't there a junction-style form for types? | 16:56 | ||
Zoffix | m: my \term:<Int∞> = subset :: of Real where { $_ ~~ Int or $_ ~~ Inf }; say ∞ ~~ Int∞; say 42 ~~ Int∞; say 0e0 ~~ Int∞ | ||
camelia | True True False |
||
grondilu | m: say 13 ~~ Int|Inf | ||
camelia | True | ||
grondilu | m: say Inf ~~ Int|Inf | ||
camelia | True | ||
grondilu | m: say pi ~~ Int|Inf | ||
camelia | False | ||
Zoffix | m: my \term:<Int∞> = subset :: of Real where Int|Inf; say ∞ ~~ Int∞; say 42 ~~ Int∞; say 0e0 ~~ Int∞ | ||
camelia | True True False |
||
grondilu | m: my Int|Inf $ | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Malformed my at <tmp>:1 ------> 3my Int7⏏5|Inf $ |
||
Zoffix | m: my $ where Int|Inf | 16:57 | |
camelia | ( no output ) | ||
grondilu | that could do | ||
16:57
AlexDani` joined
|
|||
grondilu | that's actually pretty much as simple as I could have hoped | 16:58 | |
16:58
mcmillhj joined
16:59
AlexDaniel left
|
|||
grondilu | m: role Foo[Int $sign where -1|1] {}; class :: does Foo[1] {}.new | 17:04 | |
camelia | ( no output ) | ||
grondilu | m: role Foo[Int $sign where -1|1] {}; say class :: does Foo[1] {}.new | 17:05 | |
camelia | <anon|79109168>.new | ||
grondilu | hum, can't reproduce an error here | ||
m: role Foo[Int $sign where -1|1] {}; say class :: does Foo[pi] {}.new | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> No appropriate parametric role variant available for 'Foo' at <tmp>:1 |
||
grondilu | nvm | 17:06 | |
17:07
AlexDani` left
17:11
leont joined
|
|||
Zoffix | m: my \term:<Int∞> = subset :: of Real where { $_ ~~ Int or $_ ~~ Inf }; sub (Int∞) {}(42) # can't actually use a term as a type constraint | 17:11 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> A parameter may only have one prefix type constraint at <tmp>:1 ------> 3re { $_ ~~ Int or $_ ~~ Inf }; sub (Int∞7⏏5) {}(42) # can't actually use a term as |
||
Zoffix | m: my \term:<Int∞> = * ~~ Inf|Int; say ∞ ~~ Int∞; say 42 ~~ Int∞; say 0e0 ~~ Int∞ # and for this usecase it could well be just a Callabler | 17:12 | |
camelia | True True False |
||
Aaronepower | What's the perl way to convert a hash to named arguments? | 17:22 | |
perl6* | |||
jnthn | | | ||
Zoffix | m: my %h = :42a, :70b; { dd [ $:a, $:b ] }( |%h ) | 17:23 | |
camelia | [42, 70] | ||
17:24
dogbert11 joined
|
|||
Zoffix | m: grammar A { token TOP { "A" } }; class A-A { method TOP($/) { make 42 } }; class B-B { method TOP($_) { .make: "Meow {.<A::TOP>.made}" } }; grammar B { token TOP { {$/.set_actions: A-A } <A::TOP> { $/.set_actions: B-B } "B" } }.parse(:actions(B-B), "AB").made.say | 17:27 | |
camelia | Meow 42 | ||
Zoffix | Aaronepower: ^ .set_actions is not part of the language, but the above seems to do what you want | ||
Aaronepower | Zoffix: thanks! | 17:28 | |
17:29
troys is now known as troys_
17:30
a3r0 left
17:32
wamba joined
17:33
aindilis left
17:34
aindilis joined
17:36
Sgeo joined
|
|||
HoboWithAShotgun | m: my $s = supply { for 1 .. 3 { sleep(2); emit($_); } }; react { whenever $s -> $x { say $x; } } | 17:36 | |
camelia | 1 2 3 |
||
HoboWithAShotgun | also on the shell this has no output for 6 seconds, then dumps all values at once | 17:37 | |
why isn't the output coming in two second intervals? | 17:39 | ||
hey jnthn++ i just watched your talk about parallelism and concurreny | 17:40 | ||
17:40
a3r0 joined
|
|||
timotimo | HoboWithAShotgun: the whenever only starts once the supply block has finished running | 17:42 | |
Aaronepower | How do you get a value from a hash with a variable? | 17:43 | |
Zoffix | m: my %h = :42a; my $v = 'a'; say %h{$v} | ||
camelia | 42 | ||
Aaronepower | Zoffix: cheers! | ||
Zoffix | %h<foo> is just a shortcut for %h{'foo'} | ||
%h<foo> is just a shortcut for %h{<foo>} # more accurately, since it does allomorphs | 17:44 | ||
timotimo | and %h<foo bar> is short for %h{'foo', 'bar'}, which is also important | ||
(but including the allomorph thing) | |||
Zoffix | m: my %h := :{ <42> => "allomorph", 42 => "Int", "42" => "Str" }; say %h<42>; say %h{42}; say %h{"42"}; say %h{<42>} | 17:45 | |
camelia | allomorph Int Str allomorph |
||
Aaronepower | Is there a way to refer an outer `$_` from an inner for loop? | 17:47 | |
Zoffix | (don't matter much for regular hashes, I suppose; only for Setties/Baggies/Object hashes) | ||
Aaronepower: rewrite to not need it :) Also, $OUTER::_ or something | |||
m: with 42 { say $OUTER::_ for ^3 } | 17:48 | ||
camelia | 42 42 42 |
||
Zoffix | m: with 42 { say "$_:$OUTER::_" for ^3 } | ||
camelia | 0:42 1:42 2:42 |
||
Zoffix | m: with 42 { say "$_:$^hehehe" for ^3 } | 17:49 | |
camelia | 0:42 1:42 2:42 |
||
Zoffix | ^_^ | ||
Aaronepower | Zoffix: cheers | 17:52 | |
17:53
cdg joined
17:54
leont left
17:55
andrzejku_ joined
|
|||
thunktone | Is there any way to add to the end of the autogenerated "Usage" message without erasing the generated part? | 17:56 | |
I can't seem to access $?USAGE at all | |||
Zoffix | I think it's NYI | 17:57 | |
17:57
cdg__ left
|
|||
Zoffix | hm, actually I see it being set.... hm | 17:58 | |
17:58
cdg left
|
|||
thunktone | It is producing output, I just can't access it within the program. | 17:58 | |
Zoffix | m: use nqp; sub MAIN ($a) { }; sub USAGE { say nqp::getlexcaller(q|$?USAGE|) ~ "moaaaar stuff" } | 18:00 | |
camelia | Usage: <tmp> <a> moaaaar stuff |
||
18:00
leont joined
|
|||
Zoffix | thunktone: you could use this in the meantime, though `nqp` is not standard language or supported. I'll poke at it right now and see to it that $?USAGE is available from userland | 18:00 | |
18:00
Cabanossi left
|
|||
thunktone | thanks | 18:01 | |
18:02
Cabanossi joined
18:06
a3r0 left
18:07
leont left
18:10
leont joined
|
|||
HoboWithAShotgun | how do i get out of a whenever Supply.interval(1) -> $v { } block, so the reacting block returns and the program continues | 18:15 | |
i can die, but that can't be it, right? | |||
jnthn | done | 18:16 | |
yoleaux | 17:26Z <dogbert11> jnthn: wrt the failing syntax.t test, got this after several attempts: gist.github.com/dogbert17/d018b0f6...0f734d0dbc | ||
jnthn | m: react whenever Supply.interval(0.2) { .say; done if $++ == 5 } | 18:17 | |
camelia | 0 1 2 3 4 5 |
||
jnthn | m: react whenever Supply.interval(0.2) { .say; done if $++ == 5 }; say "afterwards" | ||
camelia | 0 1 2 3 4 5 afterwards |
||
HoboWithAShotgun | yay :) | ||
18:19
leont left
|
|||
Zoffix | So what are "compile time variables"? | 18:21 | |
Or more to the point: why is $?USAGE a compile time variable | |||
m: use nqp; sub MAIN ($a) { }; sub USAGE { BEGIN say nqp::getlexcaller(q|$?USAGE|) ~ "moaaaar stuff" } | 18:22 | ||
camelia | Use of uninitialized value of type Any in string context. Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful. moaaaar stuff in code at <tmp> line 1 |
||
Zoffix | I "fixed" it, but it's not compile time and I don't get why we need to pay for generation of usage messages if we don't even know if we'll ever need 'em | ||
18:24
a3r0 joined
|
|||
Zoffix moves this to #perl6-dev | 18:24 | ||
18:25
espadrine joined
18:38
nightfrog left,
Rawriful joined
|
|||
Zoffix | thunktone: it might take awhile to fix it actually. Some design issues are blocking it currently: github.com/rakudo/rakudo/commit/bbedf18d3c | 18:39 | |
18:41
thunktone left,
domidumont left
18:43
thunktone joined
18:45
Cabanossi left
18:47
Cabanossi joined
18:48
AlexDaniel joined
19:02
mcmillhj left
|
|||
weabot | is there a way to import a file from the path as with #include "path/to/header.h" in C? | 19:06 | |
to just import existing subroutines from it | |||
19:06
mcmillhj joined
|
|||
Zoffix | weabot: try: EVALFILE 'path/to/header.h' | 19:07 | |
weabot: nevermind, it runs in its own "scope", so not like #include | 19:08 | ||
weabot | that only returns a single structure from the file doesn't it? | ||
Zoffix | As far as I understand, it's like 'path/to/header.h'.IO.slurp.EVAL | ||
weabot | hmm | 19:09 | |
Zoffix | But I just tried it with `sub foo {}` in the file and it doesn't become available in the program | ||
m: 'sub foo { say "hi" }'.EVAL; foo | 19:10 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: foo used at line 1 |
||
Zoffix | m: 'our sub foo { say "hi" }'.EVAL; foo | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: foo used at line 1 |
||
19:10
astj joined
19:14
astj left
19:16
pecastro left
19:26
darutoko left
19:27
pecastro joined
19:31
grondilu left
19:39
krunen left,
krunen_ is now known as krunen
19:46
TEttinger joined
19:52
Aaronepower left
19:56
eliasr left,
astronavt left
20:09
cdg joined
20:10
mcmillhj left
20:17
LanceW joined
20:22
mcmillhj joined
20:23
AlexDaniel left
20:27
mcmillhj left
20:32
andrzejku_ left,
lichtkind left
20:35
pecastro left
20:39
mcmillhj joined
20:41
Ven`` joined,
pecastro joined
20:42
itaipu left
20:43
mcmillhj left
20:51
LanceW left
20:52
|oLa| left,
mcmillhj joined
20:57
mcmillhj left
21:03
Rawriful left
21:05
Rawriful joined
21:07
troys_ is now known as troys
21:09
skids left
21:18
setty1 left,
itaipu joined
21:29
perlpilot left
21:30
rgrau left
21:45
Cabanossi left
21:47
Cabanossi joined
21:55
astj joined
21:59
astj left
22:03
zoli__ joined
|
|||
zoli__ | (1..5).say | 22:04 | |
(1..5).join | |||
geekosaur | "m: " | ||
zoli__ | wondering why .say (or .perl) returns 1..5, but join (and reduce...) returns what I expect (12345) | 22:05 | |
geekosaur | m: (1..5).WHAT.say | 22:06 | |
camelia | (Range) | ||
zoli__ | ah, so it is a range, but just not expanded; thanks | ||
geekosaur | join and reduce operate on lists/arrays, so trigger conversion | ||
Zoffix | m: say eager 1..5 | 22:07 | |
camelia | (1 2 3 4 5) | ||
zoli__ | just starting with perl6; I'll have to use WHAT more | ||
geekosaur | m: (1..5).list.say | ||
camelia | (1 2 3 4 5) | ||
Zoffix | zoli__: use .^name instead. .WHAT returns a type object, while .^name returns the string with the actual name | ||
zoli__ | m: (1..5).name | 22:08 | |
camelia | No such method 'name' for invocant of type 'Range'. Did you mean any of these? none note race take in block <unit> at <tmp> line 1 |
||
Zoffix | It's .^name not .name | ||
zoli__ | m: (1..5).^name | ||
camelia | ( no output ) | ||
zoli__ | m: (1..5).^name.say | ||
camelia | Range | ||
zoli__ | cool, thanks Zoffix and geekosaur | ||
Zoffix | $foo.^bar is short for $foo.HOW.bar($foo); it's a method call on the object's metaobject | 22:09 | |
gfldex | m: LABEL: for 1..3 {}; say LABEL.WHAT | ||
camelia | (Label) | ||
gfldex | m: LABEL: for 1..3 {}; say &LABEL.WHAT | ||
camelia | Nil | ||
gfldex | o.0 | ||
what the heck is an &-sigiled Label and why is it Nil? | 22:10 | ||
Zoffix | m: constant foo = 42; say &foo | 22:11 | |
camelia | Nil | ||
Zoffix | mc: constant foo = 42; say &foo | ||
committable6 | Zoffix, ¦2015.12: «Nil» | ||
Zoffix | Ah, `foo` with a `&` coercer | ||
m: say &42 | |||
camelia | Nil | ||
Zoffix | m: say &&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 22:13 | |
camelia | () | ||
Zoffix | m: constant $z = 42; say &$z | ||
camelia | 42 | ||
Zoffix | m: constant z = 42; say &z | 22:14 | |
camelia | Nil | ||
Zoffix | inconsistent | ||
m: constant z = 42; say &(z) | |||
camelia | 42 | ||
22:15
troys is now known as troys_
22:16
zoli__ left
|
|||
Zoffix | Filed as rt.perl.org/Ticket/Display.html?id=132146 | 22:18 | |
22:18
itaipu left
22:19
espadrine left
|
|||
Geth | doc: 1382193d15 | (Will "Coke" Coleda)++ | doc/Language/5to6-nutshell.pod6 'Taint there. |
22:25 | |
doc: e5f5dd96bd | (Will "Coke" Coleda)++ | 2 files whitespace |
|||
doc: 2ac4c00de3 | (Will "Coke" Coleda)++ | 2 files Fix code samples |
|||
22:26
Aaronepower joined,
troys_ is now known as troys
22:30
mcmillhj joined
22:31
Cabanossi left
|
|||
Aaronepower | How would I with a Grammar get everything up to two certain words preserving those words to be parsed by the next rules? Here's what I tried so far: "Hello World BREAK Foo Bar STOP" code: `grammar Foo { rule TOP { <text> <foo> <bar> } rule foo { 'BREAK' <text> } rule bar { 'STOP' <text> } rule text { .+ <?before 'BREAK'> | <?before 'STOP'>} }` | 22:32 | |
22:32
Cabanossi joined
22:34
mcmillhj left
22:36
nightfrog joined,
vike left
22:37
cdg left
22:38
vike joined,
vike left,
cdg joined
22:44
skids joined
|
|||
timotimo | Aaronepower: are you intending for the .+ in the rule text to only be allowed before a "BREAK"? | 22:45 | |
because the | puts the .+ and <?before BREAK> on one side of the alteration and only <?before STOP> on the othe | |||
22:45
mcmillhj joined
22:46
AlexDaniel joined
|
|||
Aaronepower | timotimo: No I just want all the items before "BREAK", and allow for BREAK to be used by the grammar for rules after this one. | 22:46 | |
22:47
thunktone left
22:49
HoboWithAShotgun left
22:50
mcmillhj left
|
|||
timotimo | right, that should work | 22:51 | |
i'd expect you can also use )> before the BREAK | STOP part | |||
will still have to put [ ] around the break/stop part, though | 22:52 | ||
[Coke] | Readline erroring out trying to install on mac, using a readline from macports. | ||
ah, github.com/drforr/perl6-readline/issues/12 | 22:54 | ||
22:55
rindolf left
|
|||
Aaronepower | timotimo: I'm sorry I don't understand. I just that code doesn't work paste.rs/dAF You're saying it is? | 22:57 | |
just said* | |||
timotimo: Here's the updated version. paste.rs/spX | 22:59 | ||
timotimo | well, that can't work | ||
it expects a text after STOP | |||
so there has to be more text and another BREAK or STOP there | |||
23:00
robertle left
|
|||
Aaronepower | timotimo: paste.rs/WTc | 23:00 | |
timotimo | that looks more correct | ||
what i generally find is whitespace stuff is difficult | |||
that often screws me over when i use "rule" | 23:01 | ||
23:01
vike joined
|
|||
Aaronepower | So what I'm expecting is essentially three <text> rules like `[Hello World]` `[Foo Bar]` `[Real Talk]` | 23:01 | |
timotimo | i'll grab the code and try it out locally | ||
23:01
mcmillhj joined
|
|||
timotimo | oh | 23:02 | |
you have another problem | |||
the text rule matches everything until the last BREAK | 23:03 | ||
then not problematic, since rule does do backtracking | |||
making it .+? instead of .+ makes it parse for me | |||
Aaronepower | timotimo: Can you show me that code as just changing it from `.+` to `.+> | 23:04 | |
timotimo | hold on, something's not right | ||
Aaronepower | `.+?` did not work. | ||
timotimo | yes, bear with me for another moment | 23:06 | |
23:07
mcmillhj left
|
|||
timotimo | ah, yes | 23:08 | |
you're not consuming the last BREAK or STOP | |||
so you successfully match, but you don't match up until the end of the source text | |||
.parse will consider that a failure | |||
if you use .subparse instead, that won't force beginning-to-end match, and thus will succeed | |||
23:09
cdg left
|
|||
Aaronepower | timotimo: Nope, changing it to subparse just gives me `#<failed match>` | 23:09 | |
timotimo | m: paste.rs/J4Y | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3https:7⏏5//paste.rs/J4Y expecting any of: colon pair |
||
timotimo | aaw | ||
anyway, my working code is at that address | |||
Aaronepower | timotimo: Is there no way to have that functionality with parse? | 23:11 | |
timotimo | sure | ||
just gotta eat up the final BREAK or STOP in the TOP rule | |||
Aaronepower | timotimo: So `<text> BREAK <foo> STOP <bar>`? | 23:12 | |
timotimo | no, more like <text> <foo> <bar> [ BREAK | STOP ] | ||
if you want it to accept strings that don't end in break or stop, you have to also accept $ as an alternative to BREAK or STOP in the text rule | 23:13 | ||
though if your input data is really this simple, can i interest you in the awesome and versatile tool that is .split? | |||
m: "Hello World BREAK Foo Bar STOP Real Talk".split(["BREAK", "STOP"], :k).perl.say | 23:14 | ||
camelia | ("Hello World ", 0, " Foo Bar ", 1, " Real Talk").Seq | ||
timotimo | m: "Hello World BREAK Foo Bar STOP Real Talk".split(["BREAK", "STOP"], :v).perl.say | ||
camelia | ("Hello World ", "BREAK", " Foo Bar ", "STOP", " Real Talk").Seq | ||
Aaronepower | timotimo: Hang on. You added a `BREAK` to the end. That isn't how my input will look. It won't have BREAK at the end. | ||
timotimo | ok, i'll put the necessary modification in and paste agai | ||
npaste.rs/6ES | |||
oops | |||
paste.rs/6ES | 23:15 | ||
Aaronepower | timotimo: Okay, thank you for your time. | ||
timotimo | sure | 23:19 | |
i don't grammar terribly often, so it was a good opportunity to freshen up | |||
23:25
mcmillhj joined
23:29
mcmillhj left
23:37
troys is now known as troys_
23:38
wamba left
23:46
Cabanossi left
23:47
Cabanossi joined
23:54
BenGoldberg joined
|