»ö« 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.
lookatme maybe not trap, but not comfortable for me :( 00:27
timotimo lookatme: you're in luck! you can just install Slang::Tuxic! 00:35
Zoffix Nah, don't confuse everyone who's gonna read your code :) Just use OOP and #DeathToParens :) 00:37
timotimo heh.
Zoffix Like you can write `grep * > 5, 1, 2, 3, 4` or `.grep: * > 5 with 1, 2, 3, 4` or `(1, 2, 3, 4).grep: * > 5` 00:38
That trap is documenteed tho in traps: docs.perl6.org/language/traps#Subr...thod_calls
m: constant grep = 42; say grep * > 5, 1, 2, 3, 4 # tho then you get this trap :) 00:39
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix > instead.
at <tmp>:1
------> 3constant grep = 42; say grep * >7⏏5 5, 1, 2, 3, 4 # tho then you get this t
Zoffix m: constant meow = 42; sub meow { 100 }; say meow # which is worse in this form
camelia 42
Zoffix m: class meow {}; sub meow { 100 }; say meow; # or this form 00:40
camelia (meow)
Zoffix m: constant meow = 42; sub meow { 100 }; say meow();
camelia 100
Zoffix m: class meow {}; sub meow { 100 }; say &meow(); # gotta use `&` too, as meow() here is a coercer 00:41
camelia 100
Zoffix m: class meow {}; sub meow { 100 }; say &meow(); # gotta use `&` too, as meow() here is a coercer
camelia 100
Zoffix oops 00:41
lookatme m: say &sum (1, 2, 3) 00:48
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say &sum7⏏5 (1, 2, 3)
expecting any of:
infix
infix stopper
postfix
statement end
statement modif…
lookatme m: say &sum(1, 2, 3)
camelia 6
lookatme awesome module Slang::Tuxic 00:50
daemon nn all 00:56
Geth rakudo.org: 92db004488 | (Zoffix Znet)++ | 2 files
Start repo
03:22
cfa hmm 03:51
cfa hmm 03:53
design.perl6.org/S11.html#Modules
"In the case of modules, the extra behavior is the availability of the export trait and any associated support for Perl 6 standard export semantics."
so, here's the confusion: if i create Foo.pm but omit 'unit module Foo', the export trait still seems to work as expected 03:54
is Foo 'just' a package in this case? it seems to have some module semantics 03:55
Zoffix So which cases cause Str.match return a Failure exactly? 04:01
m: dd 'x'.match: /y/, :x(1, 3, 2) 04:02
camelia Failure.new(exception => X::Str::Match::x.new(got => $(1, 3, 2)), backtrace => Backtrace.new)
Zoffix yey
Zoffix cfa: design.perl6.org contains historical archived documents. In a lot of cases they don't represent the current language. 04:13
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「sub foo is export {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; foo 04:17
camelia 42
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「sub foo is export {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; Foo::foo
camelia Could not find symbol '&foo'
in block <unit> at <tmp> line 1
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「our sub foo {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; foo
camelia 42
Zoffix Without `unit module`, you can export, but the symbols are in a specific namespace. If you `our` them, you can use them even without exporting anything 04:18
cfa Zoffix: understood, though there's very little on unit and package/module relationships in the community docs
so i went digging
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「unit module Foo; our sub foo {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; foo 04:19
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
foo used at line 1
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「unit module Foo; our sub foo {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; Foo::foo
camelia 42
Zoffix m: BEGIN '/tmp/2018-03-07/'.IO.mkdir.add('Foo.pm6').spurt: 「unit module Foo; our sub foo is export {say 42}」; use lib '/tmp/2018-03-07/'; use Foo; foo
camelia 42
Zoffix And with `unit module`, the symbol is under that module's namespace and you can use it with full name if you `our` it or you can export it. 04:20
package is just a placeholder namespace
cfa okay, but let's simplify that a bit
if i omit 'unit module Foo', what is Foo.pm6?
a package with module-like export traits?
Zoffix m: package Foo { our sub meow { say 42 } }; class Foo { method meow { say 100 } }; Foo::meow; Foo.new.meow
camelia 42
100
Zoffix cfa: don't really know. I'd call Foo.pm6 "a module" and I think most people would. 04:21
cfa nods
so does that mean that Foo.pm6 with and without 'unit module Foo' (here assuming we don't want anything else on that unit line, like :auth) are interchangeable?
Zoffix In that both would be called "a module"? Yeah, but behaviour would be different. See my evals above. 04:22
nine++ and ugexe++ are the experts in this area. They'd know all the answers on how this stuff works and what's what.
cfa thanks 04:23
it'd be helpful if the first part of docs.perl6.org/language/modules clarified this 04:24
Zoffix Yeah. Export stuff could also use more info. 04:25
cfa and unit (perhaps with more centralised info on compunits)
like, the unit docs are basically docs.perl6.org/language/syntax#Mod...eclaration 04:26
there're two things here, i guess: one is discoverability and reference documentation, the other is a gentle guide to how you go about encapsulating subs 04:27
(i'm phrasing it that way to avoid saying package or module :)) 04:28
Zoffix m: say ('abcdefghij'.subst: /y/, :x(1, 2, 3)).^name 04:48
camelia Cannot resolve caller subst(Str: Regex, :x(List)); none of these signatures match:
(Str:D $: Str:D $original, Str:D $final, *%options)
(Str:D $: $matcher, $replacement, *%options)
in block <unit> at <tmp> line 1
Zoffix m: say ('abcdefghij'.match: /./, :x(1, 2, 3)).^name
camelia Failure
Zoffix m: say ('abcdefghij'.match: /./, :nth(1, 3, 2)).^name
camelia List
Zoffix m: say (eager 'abcdefghij'.match: /./, :nth(1, 3, 2)).^name
camelia Attempt to fetch match #2 after #3
in block <unit> at <tmp> line 1
Zoffix This feels all over the place. One thing returns a Failure, the other lazily throws 04:49
m: say (eager 'abcdefghij'.match: /Y/, :nth(1, 3, 2)).^name
camelia List
Zoffix m: say ('abcdefghij'.match: /Z/, :x(1, 2, 3)).^name
camelia Failure
Zoffix And one returns a Failure regardless of the matching, while the other lazily reifies the argument and throws only if the bogus values are reified 04:50
Zoffix resists the urge to go on another rant about documenting features right away as these things pop right at you when you do -_- 04:51
u-ou is there a better way to write regex foo { ‘a’ || ‘(‘ <.foo> ‘)’ } 04:52
Zoffix m: say 'abcdefghij'.match: /./, :x("1") 04:54
camelia in Str.match, got invalid value of type Str for :x, must be Int or Range
in block <unit> at <tmp> line 1
Zoffix m: say 'abcdefghij'.match: /./, :nth("1")
camelia (「a」)
Zoffix c'mon
u-ou: nothing comes to mind
u-ou the intention is to maybe have brackets 04:55
ZzZombo it's better to use `'(' ~ ')' <.foo>` for such constructs. 04:59
Zoffix Are they equivalent?
Geth doc: 145cdc26eb | (Zoffix Znet)++ | doc/Type/Str.pod6
Add more details Str.match's :nth/:x args
05:00
synopsebot Link: doc.perl6.org/type/Str
Geth doc: f33b51a9be | (Zoffix Znet)++ | doc/Type/Str.pod6
Doc that Str.match: :nth can produce a List of matches
05:08
Zoffix Ah, no, the `~` version will call FAILGOAL on failed match 05:20
m: grammar { token TOP { '(' ~ ')' \d }; method FAILGOAL($/) { die "meows: $/" } }.parse: '(42)' 05:21
camelia meows: ')'
in method FAILGOAL at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
Geth doc: 4f6cb2161a | (Zoffix Znet)++ | doc/Type/Str.pod6
Document Str.subst[-mutate] setting of $/

For multi-match args, the List value settage was busted in Rakudo until github.com/perl6/roast/commit/af02dd68eb
05:44
synopsebot Link: doc.perl6.org/type/Str
Kaiepi proto and multi are so useful 05:59
Geth doc: 6734c7f8a1 | (JJ Merelo)++ | doc/Language/regexes.pod6
Adds whitespace closes #1832
06:39
doc: 82f6de4019 | (JJ Merelo)++ | META6.json
Eliminates IO::String as hard dep closes #1827
synopsebot Link: doc.perl6.org/language/regexes
stmuk ZofBot: WRT rakudo.org replacement I'd like something where I'm able to just commit MD into git and not mess with Wordpress (which seems to suffer frequent security issues anyway) 08:53
damm autocomplete 08:54
.tell zoffix WRT rakudo.org replacement I'd like something where I'm able to just commit MD into git and not mess with Wordpress (which seems to suffer frequent security issues anyway)
yoleaux stmuk: I'll pass your message to zoffix.
TEttinger some bot just heard "wordpress" and is already heading off to hack rakudo.org 09:36
El_Che whut 10:25
wow
rindolf hi all. sup? 12:02
dogbert2 hi rindolf 12:42
rindolf dogbert2: hi 12:43
dogbert2 rindolf: any new Project Euler solutions in the works? 13:42
rindolf dogbert2: well, i am working on one 13:46
dogbert2 which one ? 14:00
rindolf: is it one of the later ones, i.e. 612-621 ? 14:01
rindolf dogbert2: no 14:03
rindolf dogbert2: it is projecteuler.net/problem=487 14:06
dogbert2 rindolf: interesting problem. I wonder if there are any alternatives to a brute force approach. 14:12
rindolf dogbert2: yes, i came up w one 14:13
El_Che rindolf: maybe your solutions could be canaries for the speed enhancements in rakudo? (like the CSV module?) 14:15
rindolf El_Che: maybe 14:16
El_Che the same solution could be run with different compiler releases 14:17
buggable New CPAN upload: DB-Pg-0.3.tar.gz by CTILMES cpan.metacpan.org/authors/id/C/CT/...0.3.tar.gz 15:11
Geth doc: 67a578e4d2 | (Will "Coke" Coleda)++ | doc/Type/Str.pod6
fix typo
16:55
doc: 26e28eff86 | (Will "Coke" Coleda)++ | doc/Type/Str.pod6
use more straightforward word

that won't be confused with a Numeric
synopsebot Link: doc.perl6.org/type/Str
Geth Pod-To-HTML: JJ++ created pull request #31:
Avoid errors in generated docs
20:27
Geth Pod-To-HTML: 51d3fa1380 | (Juan Julián Merelo Guervós)++ (committed by Zoffix Znet) | 3 files
Avoid errors in generated docs (#31)

  * Adds precomp everywhere
  * Avoid errors in documentation
  * Comment out debug
20:54
Pod-To-HTML: c713a8e34c | (Zoffix Znet)++ (committed using GitHub Web editor) | .gitignore
Use simpler ignore rule
20:55
Pod-To-HTML: c6050e631a | (Zoffix Znet)++ (committed using GitHub Web editor) | META6.json
Bump version
Kaiepi i have a nativecall method that takes Pointer[size_t] as an argument, but when i try Pointer[size_t].new($errpos) it just creates a new pointer with $errpos as the address 21:40
how do i create it pointing to $errpos' value?
jnthn A pointer just points to some storage, it's not storage itself 21:48
CArray[size_t].new($errpos) perhaps does what's needed (a pointer to a value and a 1-element heap array are the same in C) 21:49
Kaiepi ah right, i forgot about that 21:58
Kaiepi CArray[size_t].new($errpos) works 21:59
thanks