»ö« 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. |
|||
timotimo | "such an old version" is a bit extreme for 2016.11, but still | 00:00 | |
Geth_ | gtk-simple: b66db46864 | (Timo Paulssen)++ | .travis.yml bump lowest rakudo version for zef compatibility |
||
timotimo | let's see how that goes | ||
when i've found a working version i'll also bump appveyor | 00:01 | ||
oh, huh. that's not clever ... | 00:02 | ||
our travis script for rakudo does "make test" then "make install" | |||
but if the core setting step explodes, it'll try to do the core setting again | |||
which on the jvm version takes almost 400 seconds (on travis, that is) | 00:03 | ||
Geth_ | gtk-simple: a6938136dc | (Timo Paulssen)++ | .travis.yml bump lowest rakudo version for zef compatibility |
00:08 | |
timotimo | .o( i hope it's .01 and not .1 ) | ||
benjikun | timotimo: I appreciate you doing all of this just because I brought it up lol | 00:09 | |
timotimo | well, the CI is hardly useful if nobody looks if it succeeds or fails to build | ||
TEttinger | I think it's also just important that stuff works :) | ||
timotimo | the tests in gtk-simple hardly do anything ;_; | 00:11 | |
00:12
El_Che left,
El_Che_ joined
|
|||
timotimo | anyway, looks like 2017.01 is new enough for zef | 00:12 | |
i wonder if zef should warn for earlier versions? | |||
ugexe | its rakudo, not zef that is broke | 00:13 | |
timotimo | of course | ||
00:13
MilkmanDan left
|
|||
timotimo | but it'd be helpful if zef said "hey btw this rakudo is too old yo" | 00:13 | |
rather than the ominous and unhelpful "expected 2 parameters but got 1" | 00:14 | ||
00:14
MilkmanDan joined,
mr-foobar left,
someuser left
|
|||
timotimo | wait, i said it's new enough but it hadn't even built rakudo yet, how was it supposed to maybe-fail | 00:14 | |
yeah, there it goes | |||
ugexe: you happen to know which rakudo version fixed this problem? | |||
00:15
someuser joined
|
|||
Geth_ | gtk-simple: d50c5dc437 | (Timo Paulssen)++ | .travis.yml bump lowest rakudo version for zef compatibility |
00:15 | |
ugexe | clone zef for around the same time of your rakudo version if you want to use old rakudo | ||
timotimo | hm, right | ||
actually, rakudobrew should do that | |||
benjikun | timotimo: How early did you have to claim timo on github for it not to be taken | 00:16 | |
timotimo | (actually actually, maybe don't use rakudobrew on travis) | ||
good question, let's see if my very first commit is there | |||
ugexe | rakudobrew wont do that | ||
it could grep the git log or something to do it, but it doesnt | 00:17 | ||
timotimo | benjikun: i already had it in december 2008 it looks like | ||
well, yeah | |||
benjikun | I call my cat timo sometimes | ||
his name is Timothy | |||
timotimo | i bet it's a good cat | ||
benjikun | it sure is | ||
timotimo | there's commits on github from march 2008 but i can't actually tell when i created the github account | 00:19 | |
i.e. if i made these commits off of github and later (maybe much later) pushed them there | |||
benjikun | hmm | 00:20 | |
timotimo | but i expect around that time to be correct | 00:21 | |
github wasn't very big when i got on | |||
benjikun | I'm honestly thinking about making and using a private repo thingy | ||
and abandoning my github | 00:22 | ||
ugexe | any module that spawns procs in its Build.pm should require minimum 2017.07 imo | ||
timotimo | ah is that what causes the problem in gtk-simple? | ||
ugexe | probably not the one you are seeing, it usually is prone to deadlocks | 00:23 | |
timotimo | oh, ouch | 00:24 | |
Geth_ | gtk-simple: df15c903af | (Timo Paulssen)++ | 2 files bump the "old rakudo" version by a lot to benefit from zef fixes and such |
||
00:30
Cabanossi left
00:32
mscha joined
|
|||
mscha | m: my %h{num}; %h{1e0} = 42; | 00:32 | |
camelia | Type check failed in binding to parameter 'key'; expected num but got Num (1e0) in block <unit> at <tmp> line 1 |
||
00:32
Cabanossi joined
|
|||
mscha | What's the point of allowing %hash{num} if you can't put anything in it? | 00:33 | |
ugexe | m: my %h{num}; %h{num} = 1; | ||
camelia | ( no output ) | ||
mscha | OK, you can put a type object in it. Very useful... :-) | 00:34 | |
ugexe | killer language feature | ||
geekosaur | this is more a shortcoming in our handling of boxing/unboxing numbers | 00:35 | |
(I should say Num vs. num; things like Int vs. int work, mostly) | |||
ugexe | looks liek it gets coerced | 00:36 | |
m: use nqp; my %h{num}; %h{nqp::unbox_n(1e0)} = 1; | |||
camelia | Type check failed in binding to parameter 'key'; expected num but got Num (1e0) in block <unit> at <tmp> line 1 |
||
00:36
itaipu left
|
|||
timotimo | yup, we're notg ood at that one yet | 00:40 | |
geekosaur | actually that's also an LTA error on top of being wrong | ||
well, on top of being LTA behavior | |||
timotimo | japhb: i just tried tris.p6 (tris di pasta?); fantastic! japhb++ | 00:53 | |
looking forward to being able to use arrow keys and such | |||
00:58
Erroneous_ joined
01:03
BenGoldberg left
|
|||
japhb | timotimo: Yeah, now that I can get the individual codepoints reliably, I can start decoding key escape sequences. :-) | 01:17 | |
timotimo | don't forget to kick out the comment about libuv and threads | 01:25 | |
and i expect you don't have to open /dev/tty | |||
benjikun | How hard would it be to implement an ssh client in perl6 | 01:31 | |
01:33
Zor joined
|
|||
timotimo | well, there's already a libssh binding that does async i/o | 01:38 | |
01:45
ilbot3 left,
Cabanossi left
01:48
Cabanossi joined
|
|||
zengargoyle | i seem to remember an article on RSA (or some other encryption) that had quite minimal p6 by using all of the expmod() and prime built-in mathy things. | 01:49 | |
TEttinger | expmod? | 01:50 | |
exponent in a modular arithmetic field? | |||
zengargoyle | something like e**x mod n but yeah, but not the obvious simple math thing. | 01:51 | |
01:52
ilbot3 joined,
ChanServ sets mode: +v ilbot3
|
|||
timotimo | yeah, there's algorithms for expmod that perform a whole lot better than exponentiating and then modding | 01:54 | |
both in terms of speed and memory usage | |||
bedtime | 02:00 | ||
02:07
vendethiel joined
02:15
bjz joined
02:29
araraloren joined
02:35
M-Illandan joined
02:45
Cabanossi left
|
|||
SmokeMachine | m: say "bla:ble".split: /:/ | 02:45 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unrecognized regex metacharacter : (must be quoted to match literally) at <tmp>:1 ------> 3say "bla:ble".split: /:7⏏5/ expecting any of: argument list term |
||
SmokeMachine | m: say "bla:ble".split: /":"/ | 02:46 | |
camelia | (bla ble) | ||
SmokeMachine | :) | ||
02:48
Cabanossi joined
02:55
noganex_ joined
02:58
noganex left
03:05
Zor left
|
|||
araraloren | morning | 03:17 | |
String is faster than regex | 03:18 | ||
03:18
Erroneous_ left
03:20
rubio_terra left
|
|||
SmokeMachine | araraloren: yes, but my real case is /\s* ":" \s*/ | 03:21 | |
araraloren | SmokeMachine, I test it, split with ":" the trim is faster than split by regex | 03:27 | |
s/the/then/ | |||
03:28
Cabanossi left
03:31
Cabanossi joined
03:32
bjz left
03:36
skids joined
03:39
bjz joined
|
|||
araraloren | .tell andrzejku After we add the run configuration, it was working! | 03:46 | |
yoleaux | araraloren: I'll pass your message to andrzejku. | ||
araraloren | .tell andrzejku Though it has a different with what we thought . | 03:47 | |
yoleaux | araraloren: I'll pass your message to andrzejku. | ||
04:00
itaipu joined
04:14
ryu0 joined
04:16
itaipu left
04:23
mscha left
04:29
Cabanossi left
04:31
Cabanossi joined
|
|||
jeromelanteri | hello all | 04:44 | |
with Git::Wrapper, how to get any unsucces/errors/failed things who should happen eventually ? | |||
araraloren | catch exception ? | 04:50 | |
jeromelanteri | araraloren, there is no exception to catch... command is send, then... i hope to have with this module a kind of "success" variable... | 04:56 | |
an other one question, i have many modules <add remove modify install uninstall update> and some sub functgions had same name: <all_repos repo_from_group, etc...> | 04:57 | ||
then there is conflicts the way i do declare things... our sub all_repos($things) is export(:MANDATORY) {...} | |||
from there, i can call: add::all_repos(my_things); | 04:58 | ||
i want to be able to call modules by there own name, and keep same names functions without have problems... it should be possible correct ? but how to ? | |||
araraloren | jeromelanteri, do you mean, call $whatmode:add_repos(...) ? | 05:09 | |
s/mode/module/ | |||
geekosaur | I am not understanding the question here | 05:11 | |
geekosaur is guessing all those uses of "module" should be "method"? | 05:12 | ||
araraloren | jeromelanteri, I check Git::Wrapper source code, and I think it has no something like **success** , even not handle error message | ||
geekosaur | in which case: a method call has an invocant, a sub doesn't. | 05:13 | |
$foo.method_here(...) | |||
vs. some_sub_here | |||
er, some_sub_here(...) | |||
05:14
ilbot3 left
|
|||
geekosaur | if you actually mean modules, giving them names like add or remove is a really bad idea because yes, it conflicts. I'm not sure it even makes sense to split modules that way... | 05:16 | |
but if somehow it does, a namespace prefix is likely a good idea. use Foo::add; Foo::add::somesub(...); | 05:17 | ||
also you should be aware that lowercase module names are reserved for pragmas | |||
05:18
ilbot3 joined,
ChanServ sets mode: +v ilbot3
|
|||
geekosaur | (as are all-uppercase names) | 05:18 | |
ryu0 | I have experience mostly with traditional unix languages (C, Awk, Shell), with C being the one I have the most experience with. I have been looking for a language to supplement these, but I have no prior experience with Perl. Would Perl be a good fit for me? If so, why might it be? | 05:19 | |
geekosaur | for example, "use fatal;" in a scope causes all Failures (delayed exceptions that throw if used without testing/defusing them first) to become normal exceptions | ||
ryu0, with that background perl 5 is likely the better fit... but it's always good to expand your horizons | 05:21 | ||
araraloren | ryu0, here is Perl 6, Perl 5 is borrow many idea from C Awk Shell | ||
ryu0 | geekosaur: why? i was thinking perl6 might be more in line with what i'm wanting to do. | ||
geekosaur | and these days it's hard to get by without experience in *some* OO language. (perl 5 and python don't really count, their OO is baling wire and chewing gum, aside from p5's Moose which instead s painfully slow) | 05:22 | |
ryu0 | I have also dabbled in functional languages, but wasn't too thrilled with them. | ||
Mostly their syntax was weird. | |||
araraloren | Perl 6 is actually modern language | ||
ryu0 | Lisp in particular. | ||
araraloren | with multi programming form | 05:23 | |
geekosaur | lisp certainly takes some getting used to. there are functional languages that aren't Lisp/Scheme or ML family, though; take a look at scala. | ||
ryu0 | I actually liked the SML variant of ML. | ||
Was easier to relate to. | |||
I also tried Go, so I do have some experience with OO constructs. | 05:25 | ||
C++ is something i've also had to use at points. | |||
jeromelanteri | araraloren, geekosaur yes, i'm talking about modules, so, sub function, not method class object nor instance things. | 05:26 | |
unit module a; our sub blabla() is export(/MANDATORY) { } // use a; a:blabla(); works, but if i have: | 05:27 | ||
unit module b; our sub blabla() is export(:MANDATORY) {} // use a; use b; a::blabla() (error... two functions has the same name) | 05:28 | ||
geekosaur | don't use all-lowercase module names; they are reserved for use as pragmas. (and a few internals modules that you proably don't want to mess with) | ||
also, you are basically asking for that when you export the names; you are telling perl 6 to pull those names into your namespace. | 05:29 | ||
although qualified *should* work. | |||
since they're "our" | |||
jeromelanteri | geekosaur, ok | 05:30 | |
so actually, what can be the solution ? | |||
if i remove "our", i can no more call A::blabla(); | 05:31 | ||
05:31
benjikun left
|
|||
geekosaur | I am still not understanding | 05:38 | |
you want to force multiple declaration? what is supposed to happen? | |||
I mean, you are basically creating an impossible situation and saying that you think it is the correct way to do things | |||
you are exporting with forced import suns with the same name from multiple modules | 05:39 | ||
the result will be Cannot import symbol &foo from Bb, because it already exists in this lexical scope | |||
either don't export and use qualified names, or export with a tag so users can choose to import or not as needed | 05:40 | ||
jeromelanteri | geekosaur, each function is embeded inside a module... | ||
geekosaur | if I kill the is export(:MANDATORY) then I can call Aa::foo and Bb::foo with no problem | ||
jeromelanteri | it can have a function in module A same name that an other one function in module B | 05:41 | |
geekosaur | if you force export with is export(:MANDATORY) then it cannot *import* two modules doing so with the same name into the same scope | ||
jeromelanteri | then call by A::bla(); B::bla(); for make this works ? why impossible ? it should be possible by the fact they are embeded in different modules... | ||
geekosaur | that does work | ||
what does not work is "use"ing both of those, because they both try to define bla() *in the module that "use"s them* | 05:42 | ||
because you said is export(:MANDATORY) | |||
jeromelanteri | geekosaur, so just remove is export(:MANDATORY) should do the job i want ? | ||
geekosaur | yes | ||
you don't need to export them, you made them "our" | 05:43 | ||
05:43
pilne left
|
|||
jeromelanteri | geekosaur, oh ok, fine... | 05:43 | |
so export is for put them in the scope with a kind of tag (:MANDATORY is the default one) | |||
geekosaur, thank you | 05:44 | ||
geekosaur | export is to make them appear as if they were defined in the module that "use"s them | ||
jeromelanteri | ok | ||
05:44
khw left
|
|||
geekosaur | you can see why this is a problem if you do that to functions with the same name in two different "use"d module | 05:44 | |
05:44
Cabanossi left
|
|||
jeromelanteri | so yes, definitly, by call module name, i absolutly no need is export | 05:45 | |
geekosaur | you could put them on some other tag so people can choose to import them into their namespace, if they know it won't cause a problem, by specifying that tag | ||
use Foo :IMPORTS; # or some such | |||
jeromelanteri | geekosaur, ho yes, that should be an other one solution | ||
geekosaur | then you can choose which one gets to use the unqualified names | ||
jeromelanteri | but then, is use A :Tag_A; use B :Tag_B with modules contain some same named functions... it should not works same or it should works ? | 05:46 | |
geekosaur | that would fail | ||
05:46
Cabanossi joined
|
|||
jeromelanteri | ok, well understand | 05:46 | |
it just call by a tag functions to export in the scop of the actual module use them... | 05:47 | ||
geekosaur | Haskell imports work the way you want, but it comes with other behaviors that surprise people | ||
jeromelanteri | yes | ||
geekosaur | there's no nice way to do things so it all somehow "just works"; *something* will be annoying | ||
jeromelanteri | geekosaur, you may be able to understand (if you want also) that this objection doesn't care about the fact i am not english and my vocabulary is limited... | 05:48 | |
geekosaur, but do what you want, and thank you for your help. | |||
geekosaur | I had noticed (you seem to be translating some French idioms that don't quite work in English) | 05:49 | |
sadly my French is not very good | |||
jeromelanteri | yes, i'm french | 05:50 | |
araraloren | jeromelanteri, you can show him the module code | ||
jeromelanteri | i will not hurt you the day you will try to write french and not find the precise best words for explain your problem, don't worry. | ||
araraloren, yes i can: bitbucket.org/jerome___/vimplugger/src | 05:51 | ||
all modules actually... i'm going to just remove all export things | |||
geekosaur | I'm not complaining, just noting. | ||
jeromelanteri | geekosaur, nop | ||
araraloren | Actually , I think Module.method is not bad thing | 05:52 | |
jeromelanteri | what is "module.method" ? i thank that method is not module, but class method | ||
module.function and class.method.. isn't it ? | |||
geekosaur | I would expect module.method to look for methods defined on a Module | 05:54 | |
araraloren, I think you wanted :: not . | 05:56 | ||
jeromelanteri | geekosaur, i didn't no it was possible... i always thinki (so i just start learning perl6 one week an half ago) that method is not module but for class... or maybe all file finished by .pm6 is a module... also if there is class inside. | ||
s/no/know | |||
geekosaur | a module (and other things that subclass Package, like Class) is an object like anything else, with methods. but introspection doesn't seem to work :/ | 05:57 | |
jeromelanteri | well..; that makes me confuse actually. | ||
geekosaur | m: module A {}; .say for A.^methods | 05:58 | |
camelia | No such method 'methods' for invocant of type 'Perl6::Metamodel::ModuleHOW' in block <unit> at <tmp> line 1 |
||
geekosaur | the MOP for Module is incomplete :/ | ||
module A {}; say A.WHAT | |||
jeromelanteri | :) | ||
geekosaur | er | 05:59 | |
m: module A {}; say A.WHAT | |||
camelia | (A) | ||
geekosaur | m: module A {}; say A.HOW | ||
camelia | Perl6::Metamodel::ModuleHOW.new | ||
ryu0 | geekosaur: So then why might I want to use Perl6? I don't have much of an opinion about either major version of Perl. | ||
jeromelanteri | so sub is for declaration of module.method in perl6 speaking "nice" ? | 06:00 | |
geekosaur | ryu0, I'm not really the right prson to ask.. especially right no when the only reason I'm still up is someone set off the fire alarms (it's "all clear" but they're still making it impossible to sleep...) | 06:02 | |
also apparently I can't type... oy | |||
ryu0 | Ok. | ||
jeromelanteri | geekosaur, you taold something interesant about pragmas and modules names conventions... | 06:03 | |
what is a pragmas ? | |||
do i need then to move files modules names in same convention (upper case for first letter) ? | 06:04 | ||
geekosaur | to the second, yes | 06:06 | |
jeromelanteri | also, i have a files names datas.pm6 who doesn't contain a module, but a class... do i need to do same with this class name and the datas.pm6 file ? | ||
ok, move modules files names to uv first letter, and declare them same convention... and for the class inside the datas.pm6 file ? same ? | 06:07 | ||
geekosaur | classes are the same way, yes. | ||
jeromelanteri | ok | ||
thank you | |||
and a link for explain pragmas ? | |||
geekosaur | as for pragmas, they're generally instructions to change the compiler / language's behavior in the current scope | ||
docs.perl6.org/language/pragmas | |||
so, for example, ``` use lib "/usr/lib/ourstuff"; ``` tells perl 6 to look for modules in the specified directory as well as the usual places | 06:08 | ||
```use fatal;``` turns delayed exceptions ("Failure") into normal exceptions | 06:09 | ||
jeromelanteri | ok | ||
it is kind of modules reserved then ? | |||
araraloren | geekosaur, yeah, class module, or class | ||
zengargoyle | hehe... | 06:10 | |
geekosaur | so all-lowercase module names are reserved, all-uppercase module names are reserved (generally to enable dangerous things) | 06:11 | |
araraloren | If I have a sample.pm6, do I have to declare module with: unit module sample; | 06:14 | |
or the `sample` can be other thing else ? | |||
geekosaur | "unit module" is just a way to save on braces | ||
oh. they have to match, yes | |||
araraloren | So when I `use sample;` what the sample mean ? | ||
mean the filename ? | 06:15 | ||
geekosaur | when it sees that, it has to go out and look for a file with that name. | ||
it can't ask something if there is some file somewhere that contains a perl 6 module definition | |||
(at least, not if you want it to actually run today...) | |||
zengargoyle | jeromelanteri: remember i said that you try too hard with export and easy single name modules like 'check', 'install', 'add'? it would go easier if you did VimPlugin::Check, VimPlugin::Install, VimPlugin::Add and then made it easy after it works. | 06:16 | |
geekosaur | I suggested that earlier, actually | ||
not sure if it was understood | |||
araraloren, so when it sees 'use module Foo;' it checks a number of standard places (which you can add to with a ```use lib 'wherever'```; pragma) for files named Foo.pm6 or Foo.pm | 06:17 | ||
zengargoyle | geekosaur: i made a repo with mostly decent distro standards but jeromelanteri didn't wan't to even look ATM. | ||
jeromelanteri | zengargoyle, yes, i miss understood this part. | 06:18 | |
zengargoyle | it is convention that most people do not break, so nobody knows how to not do it that way.. :) | ||
araraloren | geekosaur, oh, it make sense, thanks | ||
jeromelanteri | zengargoyle, so not VimPlugin, but Add::function_name ... | ||
zengargoyle | better, but what if you ever write another program with 'Add' modules? | 06:19 | |
geekosaur | someday it might be interesting to have object filesystems where e.g. perl 6 could register a handler with it to let it respond to "find a perl 6 module named Foo". but currently nothing knows how to use such things, unless you count the simplified forms built into various GUIs (windows explorer, os x finder, gnome/kde/whatever, etc.) | ||
jeromelanteri | zengargoyle, an other one programm with Add module should not be mixed in the same lib... but ok, i understand what you mean. | 06:20 | |
zengargoyle | you can not easily have two different Add or Check modules, but you can easily have VimPlugin::Add and VimPlugin::Check. | ||
jeromelanteri | zengargoyle, look at my code, i do modify it... i think there is no VimPlugger::things... | 06:21 | |
geekosaur | jeromelanteri, maybe more to the point: someday you may want to use a program that wants to use Add from both | ||
zengargoyle | yeah, if you don't realy want to make a module you can install, or ever mix parts of different projects together... short Add will do. :P | ||
geekosaur | let's say you have a git library with Add::whatever, and a vim library with Add::whatever, and at some point you want to use them to add git integration to your vim setup | ||
"oops" | |||
06:22
statisfiable6 left
|
|||
zengargoyle | jeromelanteri: i know is feels a bit bad to have SomeLong::Name::For::A::Module, but that almost always works, and there are ways to do short name after module is finished. | 06:24 | |
jeromelanteri | zengargoyle, that also was my idea... or i missunderstand you. Could you please look at my code for be sure ? | 06:25 | |
geekosaur | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; constant RLN = ReallyLongAnnoyingName; RLN::foo; | 06:26 | |
camelia | foo! | ||
06:26
darutoko joined
|
|||
zengargoyle | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my \foo = ReallyLongAnnoyingName::foo; foo; | 06:27 | |
camelia | WARNINGS for <tmp>: Useless use of foo symbol in sink context (line 1) foo! |
||
geekosaur | (this, btw, is one reason why modules are objects) | ||
zengargoyle | heh | ||
geekosaur | hrm. that's LTA | ||
zengargoyle | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my &foo =&ReallyLongAnnoyingName::foo; foo; | ||
camelia | foo! | ||
zengargoyle | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my \foo =&ReallyLongAnnoyingName::foo; foo; | ||
camelia | WARNINGS for <tmp>: Useless use of foo symbol in sink context (line 1) |
||
zengargoyle | guess sigil matters in assignment. | 06:28 | |
06:29
wamba joined
|
|||
geekosaur | actually... | 06:29 | |
m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my \foo = ReallyLongAnnoyingName::foo; say "bar"; foo; | |||
camelia | WARNINGS for <tmp>: Useless use of foo symbol in sink context (line 1) foo! bar |
||
geekosaur | see what it did there? | ||
jeromelanteri | zengargoyle, geekosaur the idea is not to be annoying, but to give a name that make understand what it is supposed to do... then other coming (and me to) should be able to understand what the function want to do. | 06:30 | |
geekosaur | oh, I know. | ||
jeromelanteri | but sure... i can change names by LongAnnoyingName => A. It should quickly become unreadable. | 06:31 | |
geekosaur | er. that wasn't a response to you | ||
zengargoyle | call vs name for hot using &Really.... | ||
geekosaur | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my \foo = &ReallyLongAnnoyingName::foo; say "bar"; foo(); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '&foo' is not declared at <tmp>:1 ------> 3ReallyLongAnnoyingName::foo; say "bar"; 7⏏5foo(); |
||
zengargoyle | because no & | ||
geekosaur | yeh | ||
zengargoyle | but i sorta thought my \foo = &R... would maybe work. | ||
geekosaur | m: module ReallyLongAnnoyingName { our sub foo { say "foo!" } }; my \foo = &ReallyLongAnnoyingName::foo; say "bar"; foo.(); | ||
camelia | bar foo! |
||
zengargoyle | thought that was basically a bind. | ||
geekosaur | it is. but a bare simple term like "foo" is special cased | 06:32 | |
zengargoyle | ah. *nods* | ||
geekosaur | so you need the parens, but then it explodes because that too is a special case (specifically looks for & sigil), so have to use .() | 06:33 | |
jeromelanteri | wel.. all is updated on bitbucket. And now it works fine. | ||
thank you | |||
geekosaur | every DWIM has a WAT, etc. | ||
zengargoyle | jeromelanteri: i will look later... | ||
my brain still hurts from Git::Wrapper :P | 06:34 | ||
jeromelanteri | zengargoyle, it is not an obligation. But i think we were speaking about the same idea but your example seems to talk about my code without read it (so it makes me strange i xas not sure to well understand what you mean). Git::Wrapper was a real good fix for me... | 06:35 | |
Gt::Wrapper doesn't have any success "getter"... so i have to do something for read if clone things worked or not... it will be complicate i think. | 06:36 | ||
it oesn't have any error getter to... | |||
in perl5 RPC things has scucces catch... | |||
success | |||
zengargoyle | does p6 have the same thing as some p6 Exporter modules where use Foo bar => { -as => 'baz' }; or similar makes &baz = &Foo::bar ? | 06:38 | |
araraloren | The namespace is not a easy thing can better control, like c++, you must not define a function already exists in **std** | 06:39 | |
zengargoyle | jeromelanteri: yes, i need to pull code again before looking. | ||
araraloren | EXPORT ? | ||
zengargoyle | jeromelanteri: and yeah, Git::Wrapper i don't think is a *good* module. captures stderr and throws it away, doesn't check system() return codes, just assumes it works and returns stdout. | 06:41 | |
jeromelanteri | zengargoyle, but then use "run" do the same job... i not well understand the interest of Git::Wrapper if it can not do that. Maybe it will grow on this way ? | 06:42 | |
zengargoyle | somebody needed it and did the thing that worked and kept going with original problem. :P | ||
06:42
raiph left
|
|||
zengargoyle | i have done worse myself. :) | 06:43 | |
jeromelanteri | zengargoyle, if i wasn't so nOObs i would add some features... | ||
zengargoyle | i have done better myself. :) | ||
jeromelanteri | actually, i can not i think. | ||
zengargoyle, please... do it now... | 06:44 | ||
06:44
Cabanossi left
|
|||
jeromelanteri | i promise i will put your name in the title of my poor nOObs bitbucket repo... | 06:44 | |
zengargoyle | i did a lot of Wrapper at last $WORK. but don't know p6 run/shell stuff that well yet. | 06:45 | |
jeromelanteri | (crying) | 06:46 | |
zengargoyle | (sometimes the CLI program that is Wrapped doesn't even have decent error or return code.... ) | ||
jeromelanteri | i failed to find some situations for git... | ||
06:46
Cabanossi joined
|
|||
jeromelanteri | the idea is to check repo exist (that is ok... Validate), and also to tell if clone/pull requests success or not | 06:47 | |
(i said that is ok... but i'm not so sure in all situation of url that has been given) | 06:48 | ||
06:49
espadrine joined
|
|||
zengargoyle | i have not used git in an automatic way. always more manual and seeing errors and 'not working' was an OK thing for me. | 06:51 | |
so i do not know git error code or failure mode that well. usually a typo or internet is broken :) | |||
jeromelanteri | same | 06:52 | |
06:53
skids left
|
|||
araraloren | That Git::Wrapper has a little problem in META6.json | 07:02 | |
07:03
abraxxa joined
07:04
rindolf joined
|
|||
zengargoyle | araraloren: what is the problem? i have another pull-request for not working when precompiled. (so jeromelanteri is using a patched Git::Wrapper anyway). | 07:05 | |
araraloren | the provides | 07:06 | |
jeromelanteri | zengargoyle, merged with master | ||
used also the perlpilot one | |||
(but this should not make problems) | 07:07 | ||
wich branch are you in ? | |||
zengargoyle | oh, cool. i didn't see a github email. :) | ||
jeromelanteri | because it is not github... it is bitbucket | ||
07:08
abraxxa left
|
|||
jeromelanteri | zengargoyle, but... if you want to push on it, you are welcome | 07:08 | |
zengargoyle | jeromelanteri: we are missing communication. :) | ||
araraloren and i were talking about source: git://github.com/nicqrocks/p6-Git-Wrapper.git | 07:09 | ||
jeromelanteri | yes | ||
zengargoyle | i think. that is not bitbucket.... | ||
jeromelanteri | i do speak about this one in my README to | ||
araraloren, normally, if you read all the content of my readme file, you should find the solution by do things i explain. (but if not, tell me and i will correct my README file for be more clear) | 07:11 | ||
07:11
setty1 joined
|
|||
jeromelanteri | zengargoyle, ho well ... we cross speaking different things. | 07:11 | |
i do coding in the same time than... | 07:12 | ||
zengargoyle | when i pull or clone i only get master branch. | ||
of your bitbucket. | |||
araraloren | zengargoyle, yeah github.com/nicqrocks/p6-Git-Wrappe...META6.json | ||
zengargoyle | guess i need to maybe look at bitbucket api to learn branch names to pull. | 07:13 | |
jeromelanteri | zengargoyle, perfect... actually, there is only master branch | ||
zengargoyle | araraloren: what is the problem with the provides section. | ||
jeromelanteri | zengargoyle, you no need to pull Git::Wrapper branch, this branch is merged back in master now. | 07:14 | |
and bitbucket is same cxommand as git (so github same). | |||
araraloren | so the module is the file name. Can a file provide three module / | ||
? | |||
zengargoyle | a file can provide 3 classes. | 07:15 | |
jeromelanteri | araraloren, now you touch why i don't like to speak about module for a class... | ||
class/module... not the same. | |||
then why for me, method is about class (not module). | 07:16 | ||
araraloren | I don't think it's class | ||
In the provides section, include all the namespaces provided by your distribution and that you wish to be installed, only module files that are explicitly included here will be installed and available with use or require in other programs. | 07:17 | ||
This is what the document said | |||
jeromelanteri | a class can be instanciate (i don't know if this english word is correct also), but module can not. | ||
zengargoyle | i *think* once it's compiled, a class is a CompUnit. it makes little difference where on the filesystem they were before being compiled. | ||
araraloren | **namespaces ** | ||
jeromelanteri | araraloren, so why and when use class instead of module ? class is definitly for create objects to be instanciate, not modules. | 07:19 | |
concept is definitly not the same | |||
araraloren | you use a module, import name | ||
not use a name | |||
07:20
holyghost joined
|
|||
jeromelanteri | ??? | 07:20 | |
araraloren | an exported class is a name, a variable is name. | 07:21 | |
this is something in symbol table | |||
m: module A { our $e is export; }; say ::.keys; import A; say ::.keys; | 07:23 | ||
camelia | ($=pod $_ $/ A !UNIT_MARKER $e $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) ($=pod $_ $/ A !UNIT_MARKER $e $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) |
||
araraloren | m: module A { our $e is export; }; say ::.keys; | ||
camelia | ($=pod $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) | ||
araraloren | say the $e in ::.keys | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/n3NtbyZ2L7 Variable '$e' is not declared at /tmp/n3NtbyZ2L7:1 ------> 03say the 08⏏04$e in ::.keys |
||
araraloren | see | ||
m: module A { class Want {} is export; }; say ::.keys; | 07:24 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Strange text after block (missing semicolon or comma?) at <tmp>:1 ------> 3module A { class Want {}7⏏5 is export; }; say ::.keys; expecting any of: infix infix stopper… |
||
jeromelanteri | araraloren, a variable is an object... defined by a class object. | ||
araraloren | m: module A { class Want is export {}; }; say ::.keys; | 07:25 | |
camelia | ($=pod $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) | ||
araraloren | m: module A { class Want is export {}; }; import A; say ::.keys; | ||
camelia | ($=pod Want $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) | ||
jeromelanteri | and again, a module is not a class, a class is not a module. | 07:26 | |
they have some name yes... everything has a name. Do they are the same ? | |||
araraloren | I mean the name in symbol table. When you reference a class or variable, it was search that **name** in the symbol table. | ||
so the provides is not correct | |||
zengargoyle | m: module A { class Want is export {}; }; say ::.keys; say ::A::Want.WHAT; | ||
camelia | ($=pod $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) (Want) |
||
jeromelanteri | araraloren, yes sure, but what i mean is that call moduyle everything is not clear. | 07:27 | |
araraloren | you mean you don't know what the module provides ? | ||
jeromelanteri | same, a variable is define has a specific object class.. but you call it a variable, not a class. my Str $x; is a variable defined by class Str... | 07:28 | |
araraloren, no, nevermind. | |||
zengargoyle | m: module A { class Want is export {}; }; say ::.keys; say ::A::Want.new.WHAT; | ||
camelia | ($=pod $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) (Want) |
||
zengargoyle | m: module A { class Want is export {}; }; say ::.keys; say ::A::Want.new.WHAT; say Want.new.WHAT; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared name: Want used at line 1 |
||
zengargoyle | m: module A { class Want is export {}; }; say ::.keys; say ::A::Want.new.WHAT; say ::Want.new.WHAT; | 07:29 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> No such symbol 'Want' at <tmp>:1 ------> 3keys; say ::A::Want.new.WHAT; say ::Want7⏏5.new.WHAT; |
||
jeromelanteri | zengargoyle, ...oO... | ||
zengargoyle | m: module A { class Want is export {}; }; import A; say ::.keys; say ::A::Want.new.WHAT; say ::Want.new.WHAT; | 07:31 | |
camelia | ($=pod Want $_ $/ A !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) (Want) (Want) |
||
zengargoyle missed the import part. | |||
jeromelanteri | sure, a module can contain a class... a class can not contain a module... and you not use module and class for do same things. It is not the design pattern idea of "what is a class" and "what is a module". | ||
that is also why a file can not contain more than one module (due to fact that it needs to follox name of his file also), but can contain many class... | 07:32 | ||
zengargoyle | i usually don't export class. | 07:33 | |
jeromelanteri | there is conceptual idea about what a class is for and what a module is for... but sure, after, you can use class or module for other things, but it will not be a powerfull design pattern. | ||
07:33
kaare__ joined
|
|||
zengargoyle | m: module A { class Want is export {}; class Dont {}; }; import A; say A::Dont.new.WHAT; | 07:34 | |
camelia | (Dont) | ||
jeromelanteri | and that is not specific for perl6 or other OO language... it is same for all OO langage. | ||
zengargoyle | class in module is to save typing -ish | ||
jeromelanteri | yes | ||
zengargoyle | m: class A::Want is export {}; class A::Dont {}; }; say A::Dont.new.WHAT; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unexpected closing bracket at <tmp>:1 ------> 3A::Want is export {}; class A::Dont {}; 7⏏5}; say A::Dont.new.WHAT; |
||
jeromelanteri | save an object you use specifically with this module | ||
zengargoyle | m: class A::Want {}; class A::Dont {}; }; say A::Dont.new.WHAT; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unexpected closing bracket at <tmp>:1 ------> 3class A::Want {}; class A::Dont {}; 7⏏5}; say A::Dont.new.WHAT; |
||
zengargoyle | m: class A::Want {}; class A::Dont {}; say A::Dont.new.WHAT; | 07:35 | |
camelia | (Dont) | ||
jeromelanteri | araraloren, you get it ? | ||
zengargoyle | m: module A { class A::Want is export {}; class A::Dont {}; }; import A; say A::Dont.new.WHAT; | 07:36 | |
camelia | (Dont) | ||
zengargoyle | and it's smart.... | ||
m: module A { class A::Want is export {}; class A::Dont {}; }; import A; say A::Dont.new.WHAT; say A::A::Dont.WHAT; | 07:37 | ||
camelia | (Dont) Could not find symbol '&Dont' in block <unit> at <tmp> line 1 |
||
07:37
kaare_ left
|
|||
araraloren | no I don't mean the module you declare in a .pm6 or whatever file | 07:39 | |
I mean the module what we `use module;` | 07:40 | ||
use | |||
07:40
kaare__ left
|
|||
jeromelanteri | there is also this problem about declare or define...i used to make things with C++... | 07:41 | |
07:41
kaare__ joined
|
|||
jeromelanteri | araraloren, i understand what you mean... do you understand what i mean to ? | 07:42 | |
zengargoyle | if i understood correctly, when using a filesystem CUR like with -Ilib or 'use "lib"' then the name of the file (minus extension and :: ized) is used to find the module. | ||
araraloren | a little.. | ||
jeromelanteri | talk about module for a class make things confuse more than clear (this resume what i mean) | ||
zengargoyle | unless there is a META that has that information like when using -I. in a distribution directory, then it used information from META. | 07:43 | |
whan looking in other system CUR, it is just the name of the thing. there's no filesystem file name information left once it has been compiled and in CUR. | 07:44 | ||
anyways, it's really complicated compared to perl 5 :) | |||
07:45
holyghost_ joined,
Cabanossi left
|
|||
jeromelanteri | so in perl6, if i well understand, "use" is a kind of concept macro command for ("import" +" load")... ? And it can depend of a context (use lib // use Something => what is inside ?//). | 07:45 | |
araraloren | it's like c++, use a namespace, import some class or variable you declare | ||
zengargoyle | maybe module all get loaded at once so you don't use each of them individually? | ||
araraloren | jeromelanteri, you have to read document carefully | 07:46 | |
jeromelanteri | ok | ||
araraloren | docs.perl6.org/language/modules#use | ||
jeromelanteri | araraloren, actually, i have many problem to well understand document sometimes... it needs maybe some more examples | ||
zengargoyle | jeromelanteri: yes, at lest use == need + import | ||
07:46
Cabanossi joined
|
|||
jeromelanteri | zengargoyle, that what i understood to. | 07:46 | |
araraloren, also, when you asked if a file can contain many modules, i'm not sure you read that doc so carrefully (or maybe same me, sometime you not reeally understand this doc). | 07:48 | ||
07:48
holyghost left
|
|||
araraloren | Hmm, don't use **module** is better solution, it's a CompUnit | 07:49 | |
but, everyone call them module | |||
zengargoyle | araraloren: did you look that up? | ||
jeromelanteri | i like to use module when his concept is good for what i need... and then, i call it a module. | ||
zengargoyle | i just guessed that might be true, i don't really know. | 07:50 | |
but it makes sense if true. | |||
07:54
wamba left
|
|||
araraloren | yeah, I read it | 07:57 | |
zengargoyle | i usually make a distribution and write tests so i don't think about many details. if test works, i'm right! | ||
araraloren | I often read document, I was not familiar with Perl's thinking | ||
zengargoyle | araraloren: cool, now i know. :) | ||
aka think like Larry. :) | 07:58 | ||
araraloren | yeah | 07:59 | |
jeromelanteri | module/class is not specific to perl6. It is specific to OO languages. Like MVC is not specific to one GUI or web coding... it is a large concept of design pattern to use. | 08:00 | |
zengargoyle | i do not know many other languages well enough, and fear thinking perl 6 uses the same word to mean the same thing. | 08:02 | |
they might be using 'module' wrong! :P | 08:03 | ||
jeromelanteri | zengargoyle, i think you will be interested by read some book about algorythm and design pattern things. That is large concept of programmation. I mean... that is very funny also to read that kind of books. | 08:04 | |
zengargoyle | i have, but mostly back in C days... not really module/class as a keyword in development. | 08:05 | |
jeromelanteri | the first time i read that... OMG! it is like i realize the interest of "concept" things of algorythms. | ||
and then... rewrite most of my codes again. For me, it was like... open the light inside my dirty room... after that, i wanted to clean my room. | 08:06 | ||
i nbever see that was so dirty. | 08:07 | ||
zengargoyle | i guess a module is one .o file with many symbols in it. but a .c of many classes without a 'module' would be many .o files with only a single symbol. | ||
jeromelanteri | yes | ||
araraloren | I know what you mean the module. But perl6 also has a keyword module, it's confused anyway | 08:10 | |
jeromelanteri | that's it. | 08:11 | |
zengargoyle | now i'm maybe remembering when it was 'module Foo;' like perl 5 and was changed to 'unit module Foo;' to make a distintion that it was the whole file..... | 08:14 | |
where you could have multiple 'package Foo;' 'package Bar;' in same file without the 'package Foo { } package Bar { }' scope syntax. | 08:16 | ||
08:22
setty1 left
08:23
nadim joined
08:28
ChoHag left
|
|||
jeromelanteri | zengargoyle, actually, the machine langage (and you know that if you like asm) talk only about registers for memories, or events, or CPU unit, or mounted interfaces, adress, then command jump, branch, set, ref (some MISC proc have only 35 commands...). But conceptuels langages (and that is the power of OO and functionnal langages) is for make sesn relatively of what we know allready in our life. It is like a human interface | 08:29 | |
langage for make code readable and also for make it DRY and KISS. | |||
i wascurious of perl because of the conceptor is a linguist. | 08:30 | ||
08:44
Cabanossi left
08:45
holyghost_ left
08:46
Cabanossi joined
|
|||
zengargoyle | jeromelanteri: continue later, i must sleep. :) bon nuit. | 08:47 | |
je pense mon francais est tres mal. :P | 08:48 | ||
08:54
Cabanossi left
08:55
Cabanossi joined
|
|||
jeromelanteri | zengargoyle, il est compréhensible, bonne nuit l'homme. | 09:24 | |
09:24
brrt joined
09:29
andrzejku joined
|
|||
andrzejku | ls | 09:30 | |
yoleaux | 03:46Z <araraloren> andrzejku: After we add the run configuration, it was working! | ||
03:47Z <araraloren> andrzejku: Though it has a different with what we thought . | |||
09:44
Cabanossi left
09:47
Cabanossi joined
09:57
brrt left
09:58
andrzejku left
10:03
wamba joined
|
|||
jeromelanteri | an other one module who print nothing (and also... from README file copy/pasted...). No error, but also no nothing. module is Text::Table::List github.com/supernovus/perl6-text-table-list | 10:24 | |
10:25
TEttinger left
10:44
bjz left
10:48
bjz joined
10:53
Aaronepower left
10:57
espadrine left
11:06
kaare__ left
|
|||
gfldex | travis fails to build rakudo for me, could anyone check please? | 11:20 | |
11:27
Aaronepower joined
11:30
pharv left
11:33
espadrine joined
11:34
andrzejku joined
11:40
Rawriful joined
|
|||
gfldex | rakudo fails to build locally too | 11:41 | |
11:41
_cronus joined
|
|||
_cronus | hello, I am having trouble installing bailador | 11:42 | |
gfldex | samcv: could you unbreak rakudo please? | ||
_cronus | when I run zef install Bailador it stops after failing some tests | 11:43 | |
gfldex | _cronus: rakudo itself is broken right now | ||
_cronus | gfldex: does the previous version still work? | 11:44 | |
gfldex | _cronus: 51e59eeb5e48917ed3e825947989f91a219ce2cc should work | 11:45 | |
jeromelanteri | gfldex, what is travis ? a kind of docker ? | ||
gfldex | jeromelanteri: it's an automatic build system that is triggered by github commits | ||
jeromelanteri | ok | ||
11:46
bjz_ joined
|
|||
timotimo | i'll look into the rakudo breakage right now | 11:46 | |
jeromelanteri | _cronus, i see that there is a specific channel on IRC for bailador | 11:47 | |
11:48
bjz left
|
|||
jeromelanteri | bailador.net/ they are talking about "bailador stack channel (maybe not IRC) | 11:48 | |
_cronus | gfldex: i'm using rakudo-star-2017.07 which is older | ||
jeromelanteri: thanks | 11:51 | ||
timotimo | i do have a fix, but i'll test it first | 11:54 | |
tadzik | yeah, it's a Slack channel | ||
11:56
HoboWithShotgun joined
|
|||
HoboWithShotgun | can i tell the .perl method not to recurse into objects? | 11:56 | |
you know, like $Data::Dumper::Maxdepth in P5 | 11:58 | ||
timotimo | no, .perl is a bit dumber than that | 11:59 | |
what's your use case? | |||
perl has detection for circular references, for example | |||
12:00
Cabanossi left
|
|||
timotimo | m: my $a = []; $a.push($a); $a.push($a); say $a.perl | 12:00 | |
camelia | ((my @Array_77166080) = $[@Array_77166080, @Array_77166080]) | ||
timotimo | so if that's the problem, no problem :) | ||
HoboWithShotgun | debugging. i am not sure what is in the array of xml::element objects, so i call .perl on it. but that produces thousands of lines of output cause these things are all interconnected by their parent properies | ||
12:01
brrt joined
|
|||
HoboWithShotgun | and .perl happily follows each reference | 12:01 | |
12:01
Cabanossi joined
|
|||
timotimo | also | 12:01 | |
perl6 -e 'my @foo; @foo[0][0][0][0][0] = "hi"; @foo[0][1] = "hi"; @foo[1] = "bye"; say @foo.tree(*.self, *.self, *.self, { [] }).perl;' | |||
er | |||
m: my @foo; @foo[0][0][0][0][0] = "hi"; @foo[0][1] = "hi"; @foo[1] = "bye"; say @foo.tree(*.self, *.self, *.self, { [] }).perl; | 12:02 | ||
camelia | ((([],).Seq, "hi").Seq, "bye").Seq | ||
timotimo | m: my @foo; @foo[0][0][0][0][0] = "hi"; @foo[0][1] = "hi"; @foo[1] = "bye"; say @foo.perl; | ||
camelia | [[[[["hi"],],], "hi"], "bye"] | ||
timotimo | .tree can help you here | ||
12:07
nattefrost joined
12:08
Rawriful left,
Rawriful joined,
Rawriful left
12:13
avalenn left
|
|||
jeromelanteri | is there any ncurses kind of perl6 module(s) for forme questions tags ? | 12:15 | |
i see module use ncurses for table print, menu choose (very nice one)... but if i want to ask wuestion with ncurse ? | 12:16 | ||
questions | |||
timotimo | honestly, i'd just use zenity or any of the similar programs | 12:18 | |
or Text::Print, that's powerful and cool | |||
though tbh i've only looked at the examples, i haven't used it myself yet | 12:19 | ||
and without the raw input branch it might not yet have great input, come to think of it | |||
okay forget i said anything until in a week or so | |||
12:26
andrzejku left
|
|||
HoboWithShotgun | m: (1,2,3).map(*.WHAT) | 12:30 | |
camelia | Cannot resolve caller map(List: Whatever); none of these signatures match: ($: Hash \h, *%_) (\SELF: █; :$label, :$item, *%_) (HyperIterable:D $: █; :$label, *%_) in block <unit> at <tmp> line 1 |
||
HoboWithShotgun | why is that? | ||
12:31
kaare__ joined
12:32
itaipu joined,
andrzejku joined
12:40
someuser left
|
|||
araraloren | m:say (1,2,3).map(*.&WHAT) | 12:43 | |
evalable6 | ((Int) (Int) (Int)) | ||
12:44
brrt left,
brrt joined
12:46
brrt left
12:49
itaipu left
12:53
andrzejku left
12:54
clarkema joined
|
|||
timotimo | .WHAT is a little macro-ish | 12:57 | |
when you do *.WHAT you get Whatever instead of a whatever code curried to call .WHAT on something | |||
m: say *.WHAT | |||
camelia | (Whatever) | ||
timotimo | m: say *.foo | ||
camelia | { ... } | ||
timotimo | that's the difference | ||
12:59
Cabanossi left
|
|||
HoboWithShotgun | excuses. WHAT should give me the type object as advertised. | 13:00 | |
this language is far from production ready | |||
13:00
mr-foobar joined
|
|||
HoboWithShotgun | i am trying to get a simple script working and i constantly hit walls like this | 13:01 | |
timotimo | i don't think *.WHAT will be "fixed" | ||
13:01
Cabanossi joined
|
|||
timotimo | and .WHAT does give you the type object | 13:01 | |
*.WHAT gives you the type object for Whatever | 13:02 | ||
m: say (* - 1).WHAT | |||
camelia | (WhateverCode) | ||
timotimo | here the * - 1 gets curried as you expect, and .WHAT doesn't, so this time you get WhateverCode instead | ||
HoboWithShotgun | but thats not what it should do. if *.foo executes foo on the current list element | ||
timotimo | upper-case things are all special | 13:03 | |
HoboWithShotgun | then *.WHAT should execute WHAT on the fucking list element and not the * | ||
fine, then how would i do what i want to do? | 13:04 | ||
13:07
_cronus left
13:08
stmuk_ joined
13:10
stmuk left,
Aaronepower left,
nadim left,
nadim joined
|
|||
jeromelanteri | timotimo, text::print ? where ? | 13:11 | |
zenity ? | |||
13:13
mr-foobar left
|
|||
timotimo | not text::print, sorry | 13:16 | |
jeromelanteri | ok | ||
i really like ncurses lib use, it make nice terminal print | |||
timotimo, instead, which command could add 1000 lines in the terminal ? | 13:18 | ||
13:18
Aaronepower joined
|
|||
timotimo | "add 1000 lines"? | 13:18 | |
jeromelanteri | for (1..1000)-> { run: "echo"}; ?? | 13:19 | |
timotimo, yes, for wash the prompt | |||
timotimo | m: <foo bar baz 100>.map(*.^name).perl.say | ||
camelia | ("Str", "Str", "Str", "IntStr").Seq | ||
timotimo | HoboWithShotgun: how do you like this? | ||
jeromelanteri | because if i use mix of ncurse and actual prompter, it is very dirty | ||
timotimo | or do you need the actual type object to call methods on it? | ||
13:20
mr-foobar joined
|
|||
timotimo | why would you "run echo" instead of "say"? | 13:20 | |
jeromelanteri | timotimo, i don't know... because i'm stupid sometimes... | ||
13:23
Skarsnik joined
13:25
nadim left
13:30
zakharyas joined
|
|||
Skarsnik | Hello | 13:31 | |
timotimo | don't worry jeromelanteri :) | ||
araraloren | HoboWithShotgun, I show the code to you | ||
m:say (1,2,3).map(*.&WHAT) | |||
evalable6 | ((Int) (Int) (Int)) | ||
jeromelanteri | timotimo, i'm not. We can all be stupid sometimes. this is not a big problem when we know that. | ||
araraloren | Skarsnik, hi | 13:32 | |
HoboWithShotgun | araraloren: if i do that, i get no output | 13:36 | |
as i said. walls everywhere. i gonna do this in perl5 instead | 13:37 | ||
araraloren | HoboWithShotgun, you have to print them use say or print | ||
HoboWithShotgun | tx for listening | ||
13:37
HoboWithShotgun left
|
|||
jeromelanteri | he looks like not happy... | 13:38 | |
:) | |||
araraloren | haha | ||
yeah | |||
araraloren hear nothing, I hear nothing | 13:39 | ||
jeromelanteri | he choose an adapted pseudo also... very funny. | ||
13:45
zakharyas left
13:49
zakharyas joined,
mr-foobar left
14:14
Cabanossi left
14:16
Cabanossi joined
14:18
bjz_ left,
BenGoldberg joined
14:22
bjz joined
14:31
cdg joined
14:41
bjz left,
holyghost_ joined
|
|||
ugexe | someone putting (1,2,3).map(*.WHAT) in production code, since it was brought up, would not speak highly of that person | 14:45 | |
14:45
holyghost_ left
|
|||
ugexe | if you don't want to bother learning the less basic parts of the language just use block form of map: (1,2,3).map({ .WHAT }) | 14:47 | |
BenGoldberg | m: say *.WHAT | 14:52 | |
camelia | (Whatever) | ||
BenGoldberg | m: say *+1 | 14:53 | |
camelia | { ... } | ||
BenGoldberg | m: say *.HOW | 14:54 | |
camelia | Perl6::Metamodel::ClassHOW.new | ||
BenGoldberg | m: say *.WHY | ||
camelia | { ... } | ||
15:00
nadim joined
15:02
smls joined
|
|||
smls | m: grammar A { has $.a; token TOP { {say $.a} } }; A.new(a => 42).parse(""); | 15:04 | |
camelia | (Any) | ||
smls | ^^ Is using *instances* of grammar classes with class attributes meant to work? | 15:05 | |
bisectable6: grammar A { has $.a; token TOP { {say $.a} } }; A.new(a => 42).parse(""); | 15:08 | ||
bisectable6 | smls, On both starting points (old=2015.12 new=e051dd2) the exit code is 0 and the output is identical as well | ||
smls, Output on both points: «(Any)» | |||
15:13
zakharyas left
|
|||
ugexe | m: role Foo { has $.a; method a { $!a } }; grammar A does Foo { token TOP { {say $.a} } }; A.new(a => 42).parse(""); # seems broke, this should work at the very least | 15:13 | |
camelia | (Any) | ||
15:13
nadim left
15:14
Cabanossi left,
nadim joined
15:15
khw joined
15:16
Cabanossi joined
15:25
Aaronepower left,
Rawriful joined
15:26
hoelzro_ left,
huggable left,
hobbs left,
buggable left,
NeuralAnomaly left,
ZofBot left,
plicease_ left,
Geth_ left,
hobbs joined,
hobbs left,
hobbs joined
15:27
leego joined,
Geth___ joined,
ChanServ sets mode: +v Geth___,
buggable joined,
ChanServ sets mode: +v buggable,
plicease joined
15:36
cdg left
|
|||
jnthn | smls: They work in so far as that being how a Cursor stores its own internal state. However, each rule gets a cursor of its own, meaning a fresh instance is made per token that is entered | 15:36 | |
So the instance inside of token TOP is not the one that .parse was called on | 15:37 | ||
15:37
popov_ joined
|
|||
smls | ok | 15:37 | |
15:50
Aaronepower joined
15:51
Aaronepower left
15:53
BenGoldberg left
15:56
BenGoldberg joined
15:57
clarkema left,
BenGoldberg left
16:03
mr-foobar joined,
clarkema joined
16:06
Aaronepower joined
16:07
BenGoldberg joined
16:09
andrzejku joined
16:12
Aaronepower left
16:14
Cabanossi left
16:16
Cabanossi joined
16:21
Aaronepower joined
16:25
pharv joined,
Aaronepower left
16:30
bjz joined
16:33
araraloren left
16:37
Cabanossi left
16:38
bjz left,
khw left
16:41
Cabanossi joined
16:46
nattefrost left
16:52
leego is now known as leedo,
Cabanossi left,
bjz joined
16:54
Cabanossi joined
16:55
skids joined
17:01
popov_ left
|
|||
japhb | jnthn, timotimo: Not only is raw tty input seeming stable, as timotimo guessed, it doesn't need the fd reopen hack to force the input stream onto the processing thread anymore. Thank you, jnthn++! | 17:02 | |
Of course, now this means I need to wade back into the battle with decoding escape codes for arrow and function keys .... | 17:03 | ||
17:09
bjz left
17:12
zakharyas joined
17:15
JJ_ joined
|
|||
JJ_ | Hi there | 17:15 | |
japhb | JJ_: Hello! Did you have a question, or just saying hi? | 17:17 | |
JJ_ | For the time being, just hi and lurking for a while... | ||
japhb | It tends to be a little slower on the weekends, so don't be surprised if you don't hear much at times. | 17:18 | |
JJ_ | :-) | ||
I'm getting kind of crazy, of all things, looping over an array | 17:19 | ||
Got this array in JSON | |||
github.com/JJ/perl6em/blob/master/...short.json | |||
Gobble it up: my $json = $urls-file.IO.slurp(); my $decoded = from-json $json; | 17:20 | ||
$decoded.elems returns 39. So far so good. | |||
but then for $decoded -> $u assigns the whole array to $u in the first iteration. | |||
Any idea? This is probably pretty stupid, I know, but I can't figure it out. | 17:21 | ||
I've worked around it by using .keys, which for some reason works OK. | |||
timotimo | you want to for @$decoded or for $decoded.list | 17:22 | |
it's in a scalar container, the semantics of scalar containers are "a single thing" | |||
alternatively you could assign to @decoded instead of $decoded | 17:23 | ||
JJ_ | I tried that, didn't work. Let me check again. | ||
Yep, does not work. It @decoded.elems returns 1 | |||
timotimo | oh, heh | 17:25 | |
JJ_ | OK, I think I got it | ||
timotimo | sorry about that, you'd have to either bind with := or put @(...) | ||
because there's still the scalar container | |||
it treats it the same way as | |||
JJ_ | my @urls = @(from-json $json); | ||
timotimo | m: my @foo = $(1, 2, 3); say @foo.elems; say @foo[0].elems | 17:26 | |
camelia | 1 3 |
||
timotimo | m: my @foo := $(1, 2, 3); say @foo.elems; say @foo[0].elems | ||
camelia | 3 1 |
||
JJ_ | The problem seems to be from-json returns in scalar context. So you have to change it to Array context. | ||
timotimo | aye | ||
17:26
bjz joined
|
|||
JJ_ | Thanks! | 17:26 | |
timotimo | though context isn't the right word | ||
in perl6 context works the other way around from perl5 and earlier | |||
JJ_ | Yep, it's perl5ish | 17:27 | |
sorry. | |||
timotimo | no problem | ||
m: use LWP::Simple; LWP::Simple.get: raw.githubusercontent.com/JJ/perl6...short.json | |||
camelia | ===SORRY!=== Could not find LWP::Simple at line 1 in: /home/camelia/.perl6 /home/camelia/rakudo-m-inst-2/share/perl6/site /home/camelia/rakudo-m-inst-2/share/perl6/vendor /home/camelia/rakudo-m-inst-2/share/perl6 CompUnit:… |
||
timotimo | er | ||
star: use LWP::Simple; LWP::Simple.get: raw.githubusercontent.com/JJ/perl6...short.json | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3use LWP::Simple; LWP::Simple.get: https:7⏏5//raw.githubusercontent.com/JJ/perl6em/m expecting any of: colon pair |
||
timotimo | star: use LWP::Simple; LWP::Simple.get: "raw.githubusercontent.com/JJ/perl6...hort.json" | 17:28 | |
camelia | 501 Protocol scheme 'https' is only supported if IO::Socket::SSL is installed <URL:raw.githubusercontent.com/JJ/perl6...json> in method request_shell at /home/camelia/star-2016.10/share/perl6/site/sources/2A99795C7… |
||
timotimo | oh wow that's 2016.10? | ||
nine: can we get that up to date? | |||
17:28
andrzejku left
17:29
smls left
17:30
clarkema left
17:37
andrzejku joined
17:41
zakharyas left
17:48
andrzejku left
18:03
nhywyll joined
18:18
jaldhar_ left
18:19
jaldhar_ joined
18:25
setty1 joined
|
|||
moritz | I'm on it | 18:38 | |
18:46
klapperl joined
18:54
pharv left
18:59
domidumont joined
19:01
domidumont left
19:02
ZofBot joined,
ChanServ sets mode: +v ZofBot
19:03
huggable joined,
ChanServ sets mode: +v huggable
19:04
NeuralAnomaly joined,
ChanServ sets mode: +v NeuralAnomaly
19:05
darutoko left
|
|||
JJ_ | What do you people use for debugging? | 19:05 | |
I'm stuck with the old say this dd that | |||
19:06
dwarring joined
|
|||
moritz too | 19:08 | ||
which I tend to do in all languages I program in | |||
JJ_ | but still | 19:09 | |
breakpoints help. | |||
the old "x" in the perl5 debugger was a nice way of having formatted variables printed. | 19:10 | ||
So there's no better alternative in perl6, right? | |||
moritz | you can install Debugger::UI::CommandLine (if it works right now), and then use perl6-debug-m instead perl6-m to start your code | ||
JJ_ | That's a big if | 19:11 | |
19:11
kaare__ is now known as kaare_
|
|||
moritz | star: say 42 # for timotimo | 19:11 | |
camelia | 42 | ||
JJ_ | @moritz it apparently works, thanks for the suggestion | 19:12 | |
moritz | \o/ | 19:13 | |
19:14
Cabanossi left
19:16
Cabanossi joined
19:21
hankache joined
19:26
andrzejku joined
19:27
bjz left
|
|||
JJ_ | Now regex stuff | 19:33 | |
$text = "[captura](una.captura) y [otra](capt.ura)" | 19:34 | ||
$text ~~ /\] \( (http <-[ ) ]> +?) \) / returns una.captura | |||
Now | 19:35 | ||
$text ~~ m:global/\] \( (http <-[ ) ]> +?) \) / | |||
returns ](una.captura) | |||
So the global switch makes it forget the grouping parentheses? | |||
timotimo | moritz: perfect! <3 | ||
JJ_ | um | 19:36 | |
moritz | JJ_: I don't see any grouping parenthesis in your regex | ||
JJ_ | right before http and after ? | ||
moritz | oh right | 19:37 | |
JJ_ | they actually work... without the global switch | ||
moritz | m: my $text = "[captura](una.captura) y [otra](capt.ura)"; for $text ~~ /\] \( (http <-[ ) ]> +?) \) / -> $/ { say $0 } | ||
camelia | Nil | ||
JJ_ | m: my $text = "[captura](una.captura) y [otra](capt.ura)"; for $text ~~ m:g/\] \( (http <-[ ) ]> +?) \) / -> $/ { say $0 } | 19:38 | |
camelia | 「una.captura」 「https://capt.ura」 » | ||
JJ_ | um | ||
moritz | that looks right, now? | 19:39 | |
s/now/no/ | |||
JJ_ | looks totally right | ||
moritz | it returns a list of matches, and in each match, the [0] element matched the URL | 19:40 | |
m: my $text = "[captura](una.captura) y [otra](capt.ura)"; say $text ~~ m:g/\] \( (http <-[ ) ]> +?) \) / | |||
camelia | (「](una.captura)」 0 => 「una.captura」 「](capt.ura)」 0 => 「capt.ura」) » | ||
moritz | same thing, but since the list delimiter is not explicit, it's easier to lose track of what's going on | ||
geekosaur | looks ot me like they stringified the match object, losing the information they actually wanted | 19:41 | |
moritz | btw I'm currently working on leanpub.com/perl6regex :-) | ||
explaining "token" and "rule" right now | |||
JJ_ | Good luck! | 19:42 | |
moritz | thanks | 19:46 | |
19:47
JJ_ left
|
|||
zengargoyle | m: my $text = "[captura](una.captura) y [otra](capt.ura)"; $text ~~ m:g/\] \( (http <-[ ) ]> +?) \) /; say ~$_.[0] for $/[]; | 19:51 | |
camelia | una.captura https://capt.ura » | ||
zengargoyle | man $/ is so bizzare to get my head around... :) | ||
moritz | read my book! | 19:52 | |
I hope it explains it well | |||
if not, tell me, and I'll do my best to improve the descirption | |||
zengargoyle | hehe, i do need to re-start reading. | ||
19:54
pharv joined
|
|||
zengargoyle | moritz: i sorta started waiting for chapter contents to settle down because going back and tracking additions gave me too much deja vu. :) | 20:00 | |
zengargoyle needs to up my game on viewing diff of prose. | 20:03 | ||
moritz | zengargoyle: I understand, no problem | 20:05 | |
20:07
TEttinger joined
20:19
rindolf left
20:24
Skarsnik left,
skids1 joined,
itaipu joined
20:26
skids left
20:33
andrzejku left,
dwarring left
20:36
skids joined
20:39
skids1 left
20:50
deep-book-gk_ joined,
bjz joined
20:53
deep-book-gk_ left
20:55
itaylor57 left,
itaylor57 joined
20:59
dct joined
21:01
Cabanossi left,
cog_ left
21:02
Cabanossi joined
21:06
lizmat left
21:09
lizmat joined
21:15
dct left
21:23
hankache left
21:26
hythm_ joined
21:29
rindolf joined
21:32
wamba left
|
|||
hythm_ | hello perl6, I would like to start learning web development in perl6, is there a resource, documentation or book I can read? | 21:32 | |
timotimo | gabor szabo is writing a book about bailador (and since he started, development around bailador picked up a few more volunteers) | 21:33 | |
japhb: did you know that with Terminal::Print $p.indices -> [$x, $y] is almost twice as slow as flat $p.indices -> $x, $y? | 21:38 | ||
though of course the API is fixed so can't just change what it returns | 21:41 | ||
hythm_ | just checked it, I would like to crowdfund to help, since the book will be released in December, are there other resources to learn from now (as I want to start soon), or may be the book offer a draft version if helped with crowndfunding it! | ||
timotimo | you already know a fair bit about perl6 itself, right? | 21:42 | |
i think i've seen you in here a bunch of times | |||
hythm_ | yes I know the basics, but I'm tatally new to web development | 21:43 | |
ryu0 | Not even HTML/CSS experience? | ||
hythm_ | s/totaly/totally/ | ||
yes I know HTML and CSS | 21:44 | ||
21:45
Cabanossi left
21:46
Cabanossi joined
|
|||
hythm_ | but I don't have experience creating web app with API and nice UI, and that is my next goal, | 21:47 | |
timotimo | i somehow managed to segfault the tris example :| | 21:49 | |
21:50
bjz left
|
|||
zengargoyle | .ask jeromelanteri could you add an example my_pl6.yml file to your repo? | 21:51 | |
yoleaux | zengargoyle: I'll pass your message to jeromelanteri. | ||
hythm_ | Actually, I just got a draft version from the book with a few chapters to start with. Awesome! | 21:55 | |
zengargoyle | .ask jeromelanteri or you could email me zengargoyle at gmail.com if my_pl6.yml is sensitive data.... | 21:56 | |
yoleaux | zengargoyle: I'll pass your message to jeromelanteri. | ||
22:00
rindolf left
22:01
andrzejku joined
|
|||
nadim | japhb: did you get my message? | 22:02 | |
22:03
andrzejku left
22:06
Hotkeys joined
|
|||
nadim | hi, I am wondering (there may be an example I misssed) if it is possible to pass arguments to a pointy block that does not declare parameters. something like @a = { ;}, {;} ; and then iterate through the array an call the blocks with arguments. | 22:06 | |
timotimo | blocks, as opposed to methods, don't slurp up all nameds by default | 22:08 | |
m: my &foo = {;}; say &foo.signature | |||
camelia | (;; $_? is raw) | ||
timotimo | blocks without signatures take a single optional argument | ||
nadim | hmm, which one? hand how are they called? | 22:09 | |
timotimo | a single optional positional argument | ||
i.e. you can call the blocks with &block() or with &block(42) | 22:10 | ||
nadim | I want to avoid writing sub ($a, $b){ ;} if I can write {;} only | ||
timotimo | then you can use $^a, $^b inside the { } | ||
nadim | adnd 42 gets in $_, right? | ||
timotimo | yes | ||
if you want to avoid writing "sub", you can give a pointy block a signature | 22:11 | ||
-> $a, $b { } | |||
22:11
hythm_ left
|
|||
nadim | and call it like: &foo(1, 2) ? | 22:11 | |
or five the parameters after? | |||
-> $s, $b {}(1, 2) | 22:12 | ||
s/five/give/ | |||
timotimo | m: -> $a, $b { say "hi $a, $b!" }(99, 42) | ||
camelia | hi 99, 42! | ||
timotimo | you can, yes | ||
nadim | can a reference be used later to do that or does it have to be inline as the example above? | 22:13 | |
timotimo | of course you can put a pointy block into a variable | ||
ilmari | m: my $s = -> $a, $b { say $^a + $^b }; $s->(1,2) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Redeclaration of symbol '$^a' as a placeholder parameter at <tmp>:1 ------> 3my $s = -> $a, $b { say $^a7⏏5 + $^b }; $s->(1,2) |
||
ilmari | m: my $s = -> $a, $b { say $a + $b }; $s->(1,2) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of ->(), ->{} or ->[] as postfix dereferencer; in Perl 6 please use .(), .[] or .{} to deref, or whitespace to delimit a pointy block at <tmp>:1 ------> 3my $s = -> $a, $b { say $a + $… |
||
timotimo | or pass a pointy block as a parameter to something else without a variable in the middle | ||
ilmari | m: my $s = -> $a, $b { say $a + $b }; $s(1,2) | 22:14 | |
camelia | 3 | ||
ilmari | m: my $s = { $^a + $^b }; $s(1,2) # look ma, no pointy! | ||
camelia | ( no output ) | ||
ilmari | m: my $s = { say $^a + $^b }; $s(1,2) # look ma, no pointy! | ||
camelia | 3 | ||
22:14
|oLa| joined
|
|||
nadim | I guess that's the closes one can come | 22:16 | |
In P5 I made variables "appear in context", practical to make thing look magic. | |||
22:16
El_Che_ left
|
|||
timotimo | well, you can use dynamic variables | 22:17 | |
geekosaur | suppose you could do somethng "clever" with $*vars | ||
that | |||
nadim | I have an interfacethat is going to take a lot of subs, I need to make it as typing-less as possible | ||
geekosaur: do tell, even if it is just to learn something and not use it | 22:18 | ||
timotimo | like you can declare $*foo, $*bar, $*baz, $*quux where you call these blocks and every block can decide which of those they want to use by just refering to them like that | ||
geekosaur | I basically said what timotimo did | ||
nadim | ok, what's the mechanism behind them? | 22:19 | |
22:19
espadrine left
|
|||
timotimo | m: my @blocks = { say "nothing" }, { say "foo is $*foo" }, { say "foo and quux: $*foo, $*quux" }; for @blocks -> &block { my $*foo = "this is foo"; my $*bar = "and bar"; my $*quux = "quux here"; &block() } | 22:19 | |
camelia | nothing foo is this is foo foo and quux: this is foo, quux here |
||
nadim | their reason to exist, except for being cool | ||
22:19
|oLa| left
|
|||
geekosaur | because sometimes you need a variable that depends on the dynamic call stack instead of lexical | 22:19 | |
timotimo | dynamic variables have "dynamic scope", which means whatever is called by the function that defines it (or a function that is called by that, and so on) has access to it | ||
geekosaur | in perl 5 you do this with local() | ||
lisp variables are generally dynamic | 22:20 | ||
timotimo | and you can "override" or "shadow" dynamic variables from further up the stack by defining them in your function | ||
geekosaur | and in Haskell this is MonadReader's local | ||
nadim | so I now have 4 ways to do what I want!, land of plenty. | 22:21 | |
is it possible to type a block? | |||
timotimo | yes | 22:22 | |
you can have a restriction on the return type or the signature | |||
geekosaur | that's what timotimo was saying about -> with a signature | ||
nadim | and what can be done with a typed block? parameters wise | ||
I mean typing like assigning a class to it | |||
timotimo | docs.perl6.org/syntax/Constraining..._Signature on this very unwieldily-named page there's examples for what to put into your sub signatures | ||
if i understand right what you mean by "typed" | 22:23 | ||
nadim | thank yo both for the tips and the link | ||
nadim saves this QA session | 22:24 | ||
timotimo | can you elaborate a bit more what you want to achieve? | ||
nadim | sure | ||
timotimo | with the typing, i mean | ||
i can sort of guess what you want in general | |||
nadim | I have lines that look like this :flat(Hash, sub ($s, $depth){$s ~~ Array, 5}, sub ($s, $depth){$s ~~ Int}, ....) | 22:25 | |
the subs are user defined, and a pain to type | 22:26 | ||
I can provide some sugar for common cases but when the user wants to add something special then he needs to type all the boilerplate, I'd like to avoid that, as I am the user too | 22:27 | ||
22:27
nhywyll left
|
|||
nadim | :flat(Hash, {$_ ~~ Array, 5}, {$_ ~~ Int}, ....) looks a bit better | 22:27 | |
timotimo | i'm not sure how these blocks work exactly | 22:28 | |
it checks the thing against a type and returns a True or False and also optionally a number? | |||
nadim | yes | ||
I's like to pass more than one variable but for the sake of the dicussion let's say I pass only one | 22:29 | ||
timotimo | another thing you could do is have like (Array) => 5 meaning "if it smart matches against Array, expand it if it's below 5 levels down" or whatever | ||
nadim | I pass a type and the sub tells me if it should be flattened or not | ||
timotimo | OK, and the number? | 22:30 | |
nadim | let me paste an example | ||
22:31
pharv left
|
|||
nadim | nopaste.linux-dev.org/?1160205 | 22:31 | |
:flat flattens, if you have an Array then all it's elements are put on the same line or multiple lines depending on the teminal depth | 22:32 | ||
timotimo | what's the 10 doing there off to the side? | ||
nadim | the number says, puts 5 entries in a colums, followed by another colum of 5 entries, ... | ||
timotimo | oh | ||
that's the 11th thing in the one to its left | |||
22:33
gregf_ left
|
|||
nadim | the 11th entry contains an array of 10 entries which is itself flattened and columnized | 22:34 | |
timotimo | right | ||
nadim | data is $ds = $([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], {:a(IntStr.new(1, "1")), :b(IntStr.new(2, "2"))}) | 22:36 | |
which is pretty easy to read in dd because it is short and all number are consecutive, with mixed number it becomes impossible | 22:37 | ||
22:37
rindolf joined
|
|||
timotimo | yeah | 22:39 | |
nadim | imgur.com/Hfhiouw | 22:40 | |
timotimo | still don't understand what the flag parameters do exactly | ||
nadim | Data::Dump::Tree renders all the data vertically | 22:41 | |
:flat tell ddt to take a specific entry or type, or depth, and render it horizontally | 22:42 | ||
timotimo | and how exactly does that work? | 22:43 | |
nadim | the arguments to :flat tells it what to do. and if, on top of telling it if an entry should be flattened or not, it can also say that it wants columns | ||
timotimo | that's the number you return? | 22:44 | |
nadim | the details? :flat installs a sub_elements post filter, then an element is going to be displayed the filter is called and rather that return a list of sub elements it returns a Horizontal object that is the representatio of the sub elements, that is obtained by running a sub renderer. the sub rendere returns the rendering lines, the Horizontal object re-arranges the lines horizontally and in columns too. | 22:46 | |
the number that is returned is the amount of lines in a colum. | |||
timotimo | OK | 22:47 | |
nadim | so it would be, for example, be possible to say "a specific element needs to be rendered in columns" something like :flat({$_ === $my_big_array, 10}) | 22:48 | |
timotimo | ah, sure | 22:49 | |
nadim | actually one can already say :flat(($my_big_array, 5)). but I want a generic mechanism via subs | ||
timotimo | right | ||
nadim | the nice things with subs is that it can decide dynamically to leave it in vertical rendering, horizontal or columnar based on the element itself | 22:50 | |
timotimo | of course | ||
22:52
rindolf left
|
|||
nadim | what I like is that it is not even 100 lines of code, and I have a very fluffy style | 22:53 | |
timotimo | japhb: you know how i told you flat and -> $x, $y makes things 2x faster? no, actually, it makes things completely wrong :) | 22:54 | |
japhb: however, if i take @alphabet.roll(*), put it into my @alphseq, and use @alphseq.shift in place of @alphabet.roll, it gets about 1.8x faster | 22:59 | ||
m: say 2.9 / 5.7 | |||
camelia | 0.508772 | ||
timotimo | m: say 2.9 R/ 5.7 | 23:00 | |
camelia | 1.965517 | ||
timotimo | wow, much closer to 2x than i thought | ||
23:02
BenGoldberg left
|
|||
nadim | is there a shortcut to set a Bool variable to True or False, ie not writting $var = True | 23:04 | |
timotimo | if the bool variable has an "is default", you can assign Nil | 23:05 | |
that's 1 shorter than True or False | |||
m: my $boo = False; $foo or= 1; say $foo.perl | 23:06 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$foo' is not declared. Did you mean '$boo'? at <tmp>:1 ------> 3my $boo = False; 7⏏5$foo or= 1; say $foo.perl |
||
timotimo | m: my $boo = False; $boo or= 1; say $boo.perl | ||
camelia | 1 | ||
timotimo | nah, that doesn't turn it into a bool for you | ||
skids | m: my Bool $a; $a++; $a.say; $a++; $a.say; $a--; $a.say; $a--; $a.say; | 23:09 | |
camelia | True True False False |
||
timotimo | japhb: but changing (1..5).roll and (1..6).roll to a shift on an infinite roll doesn't make it any faster | ||
ooh, good thinking, skids | |||
23:09
CIAvash[m] left,
mack[m] left,
tadzik left,
mienaikage left,
Matthew[m] left,
tyil[m] left
23:10
ugjka left,
unclechu left,
M-Illandan left,
xui_nya[m] left,
wictory[m] left
23:12
ugjka joined
|
|||
nadim | indeed shorte and it works well with the $a++ use to make things true | 23:13 | |
23:14
ilmari[m] left
23:15
Cabanossi left
23:16
Cabanossi joined
|
|||
timotimo | you could have prefix:<⊥> (or suffix) and the one in the other direction | 23:19 | |
to truthify and falsify variables | |||
u: ⊥ | |||
unicodable6 | timotimo, U+22A5 UP TACK [Sm] (⊥) | ||
timotimo | u: DOWN TACK | ||
unicodable6 | timotimo, U+02D5 MODIFIER LETTER DOWN TACK [Sk] (˕) | ||
timotimo, U+031E COMBINING DOWN TACK BELOW [Mn] ( ̞) | |||
timotimo, 12 characters in total: gist.github.com/66d3f6d27f28205ccd...6fcca19259 | |||
23:19
samb1 left
|
|||
timotimo | ⊤ is the other one | 23:19 | |
23:20
itaipu left
23:31
samb1 joined
23:34
setty1 left
23:37
mienaikage joined
23:40
tzekid left
23:41
cog_ joined
|
|||
Geth | doc: aa912b4b19 | (Will "Coke" Coleda)++ | 2 files fixup PseudoStash docs (whitespace, spelling, grammar) |
23:45 | |
23:45
ilmari[m] joined,
tyil[m] joined,
unclechu joined,
Matthew[m] joined,
M-Illandan joined,
mack[m] joined,
tadzik joined,
wictory[m] joined,
Cabanossi left,
xui_nya[m] joined,
CIAvash[m] joined
23:46
Cabanossi joined
23:57
El_Che joined
23:58
Rawriful left
|