»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋 Set by Zoffix on 25 July 2018. |
|||
00:03
gabiruh left
00:09
reach_satori_ left,
reach_satori joined
00:23
reach_satori_ joined
00:24
reach_satori left
00:29
Xliff left
00:34
reach_satori_ left
00:48
wamba joined
01:04
kamog left
01:32
Sgeo__ joined
01:34
lucasb left
01:35
Sgeo_ left,
whosgonna left
01:45
Xliff joined
|
|||
Xliff | m: say hyper (1..100000).grep( *.is-prime ) | 01:45 | |
camelia | (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349… | ||
Xliff | That's pretty fast. Why is this slower? | ||
m: say (hyper (1..100000).grep( *.is-prime ))[* - 1] | 01:46 | ||
Actually... ^^ that times out. | |||
I don't know why. | |||
guifa | The first only calculates the ones that are needed | ||
Xliff | So why can't I get the last one calculated in a similar amount of time? | 01:47 | |
guifa | the default is to only output I think the first 50 elements when you say @foo | ||
so it only calculates the first 50 | |||
Xliff | Oh! It's CHEATING! | ||
guifa | Whereas the second one, it has to go through all the 1..10000 first to figure out the last one | 01:48 | |
It’s not cheating, it’s lazy ;-) | |||
Lazy is code for efficient :D | |||
Xliff | Right. So how can I parallelize getting the nth prime number? | 01:49 | |
01:49
camelia left
01:51
camelia joined
|
|||
camelia | (timeout) | 01:53 | |
Elronnd | Xliff: it's not a *super* parallelizable task, although cores can help. There are algorithms on wikipedia | ||
01:53
ChanServ sets mode: +v camelia
|
|||
guifa | (1..10000).grep(*.is-prime)>>.say; 11.6s on TIO | 01:56 | |
(1..10000).hyper.grep(*.is-prime)>>.say; 4.5s on TIO | 01:57 | ||
Elronnd | guifa: well, you wouldn't do it like that | 02:00 | |
you would use a prime number sieve or something like that | |||
guifa | Elronnd: oh I know. I was just saying how you could do a naive approach and still save some time. I assumed Xliff wasn’t as worried about the .is-prime and just didn’t think the hyper was actually doing anything | 02:03 | |
Geth_ | doc: 62c718117a | holli-holzer++ | 33 files update |
02:06 | |
Elronnd | guifa: oh, ok | 02:07 | |
02:08
StPetersburgh is now known as Doc_Holliwood
|
|||
Doc_Holliwood | Err, guys. I think I might have broke something. So I have local copy of the docs from a fork on github | 02:10 | |
02:10
Cabanossi left
|
|||
Doc_Holliwood | in order to update them i made a new clone, copied everything over and pushed it. Somehow I made a push to the master branch thoigh | 02:10 | |
Geth_ | doc: 45ef5e8a71 | holli-holzer++ | 33 files Revert accidental push to the wrong repository This reverts commit 62c718117a20d8c93ca10b5773807c39500ebaa9. |
02:14 | |
doc: fba598b317 | holli-holzer++ (committed using GitHub Web editor) | doc/Language/containers.pod6 Update containers.pod6 Fixing the code example about custom containers. Without the "-rw" the code dies. |
02:17 | ||
synopsebot | Link: doc.perl6.org/language/containers | ||
02:21
Cabanossi joined
02:41
Xliff left
02:45
hythm joined
02:47
reach_satori joined
|
|||
hythm | is it required to include `META6.json` file in modules or its recommended only? I'm asking because I came across 'Encode' module which doesn't have meta file. | 02:47 | |
actually it has `META6.info` but not `META6.json` | 02:51 | ||
03:04
molaf joined
03:10
reach_satori_ joined
03:12
reach_satori left,
p9s joined
03:20
AlexDani` joined
03:22
molaf left
03:25
AlexDaniel left
03:35
p9s left
03:36
p9s joined
03:44
p9s left,
p9s joined
03:46
p9s left,
p9s joined
03:52
p9s left,
wamba left,
p9s joined
03:56
p9s left,
p9s joined
03:58
p9s left
03:59
p9s joined,
p9s left
04:00
p9s joined
04:06
hythm left
04:28
eythian left
04:29
eythian joined
04:39
nightfrog left
04:45
rindolf left
04:55
nightfrog joined
05:04
wamba joined
05:06
AlexDani` is now known as AlexDaniel,
AlexDaniel left,
AlexDaniel joined
05:09
robertle left
|
|||
AlexDaniel | tobs: discord is not the only thing out there | 05:11 | |
for example, there's a matrix bridge too | |||
I'm also pretty sure there's nothing illegal in that and it's not against their tos | 05:14 | ||
depends on how it's done though | |||
while they were here they complained about discord, matrix and google. They're free to leave if the tools that we use are so misaligned with their views | 05:24 | ||
05:41
jmerelo joined
|
|||
jmerelo | releasable6: status | 05:41 | |
releasable6 | jmerelo, Next release in ≈26 days and ≈13 hours. R6 is down. At least 5 blockers. Unknown changelog format | ||
jmerelo, Details: gist.github.com/dd4377af58f56f8414...2ee20d4c7f | |||
05:41
wamba left
05:52
wamba joined
05:57
filehandle32 joined
06:05
wamba left
06:22
ravenousmoose joined
06:32
jmerelo left
06:33
wamba joined
|
|||
tyil | tobs: I am unable to alter the topic, so I can't do anything | 06:34 | |
06:37
domidumont joined
06:50
ufobat joined,
wamba left
06:53
p9s left
07:01
wamba joined
07:08
Cabanossi left
07:15
epony left,
Cabanossi joined
07:34
abraxxa joined
07:47
zakharyas joined
07:57
p9s joined
08:02
dakkar joined
08:05
sena_kun joined,
scimon joined
08:08
nebuchadnezzar left
08:12
nebuchadnezzar joined
08:16
robertle joined
08:40
wamba left,
pmurias joined
08:42
fingolfin40 joined
08:44
p9s left
|
|||
fingolfin40 | Hi. What is the shortest way to import code from file? As "include" in C? Have a nice day! | 08:44 | |
08:44
wamba joined
|
|||
sena_kun | fingolfin40, `use foo` if `foo` is in any path that is checked for libs | 08:45 | |
tadzik | there is nothing quite like include in C though, afaik | ||
sena_kun | `need foo` if you need a runtime loading, which you hardly need | ||
tadzik | unless you want to literally eval another file :) | ||
sena_kun | tadzik, well, C include doesn't make any sense in Perl 6, as Perl 6 has concept of packages, while C is "lets dump everything into a loooong file and compile that" | 08:46 | |
tadzik | sena_kun: indeed | ||
which you could do with EVAL slurp 'file.pl' if you *really* wanted to... ;) | 08:47 | ||
but that still won't work for most stuff I guess | |||
ie variables won't magically appear in your scope I think | |||
sena_kun | tadzik, I don't think import == EVAL in the question, fingolfin40? | ||
tadzik | perhaps I treated the question a bit too literally :) | 08:48 | |
sena_kun | :) | ||
tadzik | like sena_kun says, `use` is probably the way to go | ||
fingolfin40 | So, if I want just splice long program to several files, do I need use packages? | 08:49 | |
Or use? | |||
sena_kun | for example, if you have a.pm6 and b.pm6 in a single directory, you can do `use b` in a.pm6 and `perl6 -I. a.pm6`. But be careful not to run it with `-I.` from the home directory, as it'll scan everything... which will be not very nice. | ||
fingolfin40, just create a module | |||
give me a second... | 08:50 | ||
docs.perl6.org/language/modules <- a pretty long, but covering basically everything you need | |||
fingolfin40 | Thanks | 08:51 | |
sena_kun | you can use tools, e.g. `zef install Ddt` or `zef install mi6`, and then look up their readme for commands, they can create a "default" structure of a module for you to fill in the code later. | ||
but if you are starting, it is better to not rely on quick magic, and there are not so many things to know: you have your code in `lib` directory, e.g. `Foo::Bar` is `lib/Foo/Bar.pm6`, you have your tests in `t` directory, just `00-sanity.t`, and you fill META6.json file in the root. | 08:52 | ||
then you can `zef install` it and in some script: `use My::Cool::Module; call-sub-from-module(42)`. or you can create `bin` directory in your module and put scripts there, then they will be "installed" and runnable without typing `perl6 ...`. | 08:54 | ||
fingolfin40, "Distributing modules" section of the documentation is what you want. | |||
fingolfin40 | I was think that using modules is too hard for my simple work, but it seems to be the only right way. | 08:57 | |
tadzik | modules are super easy :) | 08:58 | |
you don't really need to make them installable and all that though | |||
just shove them in lib/<that path>, then run your code with perl6 -Ilib | |||
no need to install anything until you actually need to | |||
you can also do `use lib 'lib'` to your source code before you do the `use` | 08:59 | ||
then you don't need the -Ilib anymore | |||
fingolfin40 | thanks | ||
09:05
wamba left
09:08
robertle left
09:09
robertle joined
09:10
wamba joined
09:17
[particle] joined
09:19
[particle]1 left
09:26
pat_js joined
09:38
pmurias left
09:47
Black_Ribbon left
09:48
pilne left
09:52
pat_js left
09:54
isBEKaml joined
10:09
pmurias joined
10:21
robertle left
10:25
moritz_ is now known as moritz,
robertle joined
10:27
filehandle32 left
10:30
pat_js joined
10:38
wamba left
10:54
pat_js left
10:57
molaf joined
|
|||
tbrowder | hi, #perl6 | 10:58 | |
question on redefining built-in routines: | 10:59 | ||
say i want to redefine 'copy' | 11:00 | ||
i write: sub copy($a,$b) { copy $a, $b } | 11:01 | ||
moritz | now you've invented recursion :D | ||
tbrowder | which 'copy | ||
moritz | I guess you want to wrap CORE::copy? | 11:02 | |
m: sub say($x) { say $x } | |||
camelia | ( no output ) | ||
moritz is surprised there wasn't a timeout | |||
sena_kun | it wasn't called to recurse? | 11:03 | |
m: sub say($x) { say $x }; say 42; | |||
sena_kun is not a bad person who abuses bots | 11:04 | ||
tadzik | *sad violin* | ||
11:04
Geth joined
|
|||
camelia | (timeout)MoarVM panic: Memory allocation failed; could not allocate 327872 bytes | 11:04 | |
tbrowder | m: sub say($x) { CORE::say $x }; say "a" | 11:05 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3sub say($x) { CORE::say7⏏5 $x }; say "a" expecting any of: infix infix stopper statement end statement modi… |
||
sena_kun | tbrowder, you want `multi sub copy($a where 42, Str $loc) { say "Copied 42 to $loc" }; copy 42, 'foo'; | ||
oops | |||
m: multi sub copy($a where 42, Str $loc) { say "Copied 42 to $loc" }; copy 42, 'foo'; | 11:06 | ||
camelia | Copied 42 to foo | ||
tadzik | m: sub say($x) { CORE::say: $x }; say "a" | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3sub say($x) { CORE::say:7⏏5 $x }; say "a" expecting any of: colon pair |
||
tadzik | hrm | ||
tbrowder | add semi at end? | ||
tadzik | nah, it didn't like the colon calling I think | 11:07 | |
m: sub say($x) { CORE::say($x) }; say "a" | |||
camelia | Cannot find method 'Nil' on object of type Str in sub say at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
tadzik | I guess it is just for methods | ||
sena_kun | 1)you need to add multi to not shadow the existing candidate; 2)why do you need to redefine it? to handle different candidates? | ||
or to handle the same candidates in a different way? | |||
in the first case, `multi` is your friend, in the second case, why not write a simple wrapper? | 11:08 | ||
isBEKaml | m: sub say($x) { CORE::say $x }; say("a"); | ||
tbrowder | i'm trying to build a File::Copy module | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3sub say($x) { CORE::say7⏏5 $x }; say("a"); expecting any of: infix infix stopper statement end statement mo… |
||
isBEKaml | Ah, TTIAR | ||
sena_kun | instead of messing with builtins which is probably slower by definition; | ||
m: say CORE::say; say &CORE::say; | |||
camelia | Nil &say |
||
isBEKaml | CORE:: is in nqp namespace? | ||
sena_kun | just for the record, ^ is a "correct" way to do that. :) | 11:09 | |
you need to sigil things from namespaces | |||
isBEKaml | m: sub say($x) { CORE::say: $x }; say("a"); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3sub say($x) { CORE::say:7⏏5 $x }; say("a"); expecting any of: colon pair |
||
tbrowder | m: sub say($x) { &CORE::say $x}; say("6"); | 11:12 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3sub say($x) { &CORE::say7⏏5 $x}; say("6"); expecting any of: infix infix stopper statement end statement mo… |
||
sena_kun | m: sub say($x) { &CORE::say($x) }; say 42; | ||
camelia | 42 | ||
sena_kun | m: sub say($x) { my \term := &CORE::say; term 42 }; say 42; | 11:13 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3b say($x) { my \term := &CORE::say; term7⏏5 42 }; say 42; expecting any of: infix infix stopper statement end … |
||
tbrowder | \o/ yay | ||
sena_kun | apparently you can't do that without writing an operator | ||
tbrowder | sena_kun: ++ | ||
sena_kun | tbrowder, but anyway, what's the issue you are trying to solve with overloading copy? I am somehow sure just having a wrapper `my-smart-copy` will be both cheaper and easier to understand for the reader. | 11:14 | |
maybe I am wrong, though. | |||
11:15
zakharyas left
|
|||
tbrowder | well, the real issue is making the buitlin copy more usable (it's a rakudo issue i think): be able to copy a file to a dir, for example | 11:16 | |
sena_kun | a multi candidate sounds nice for that | 11:17 | |
sub (IO::Path $file where *.f, IO::Path $dir where *.d) {...} | |||
multi sub copy (IO::Path $file where *.f, IO::Path $dir where *.d) {...} | |||
tbrowder | jnthn and others want to make an enhanced copy as a module to get lots of use before considering enhancing the built-in copy | 11:18 | |
but the multi couldn't be used outside rakudo, correct? | 11:20 | ||
sena_kun | why? | ||
m: multi sub say($_ where 42) { say "SUPER 42!" }; say 42; say 10; | 11:21 | ||
camelia | SUPER 42! 10 |
||
sena_kun | e.g. you can overload operators just ok and then are part of CORE, and operators are just subs | ||
tbrowder | okay! | ||
sena_kun: thank you, i'll try that | 11:22 | ||
sena_kun | tbrowder, have fun! | 11:23 | |
tbrowder | i though you needed to use either one sub or all multis, not a mixture | 11:24 | |
see ya later, gator | 11:25 | ||
sena_kun | luckily, `say` is a multi | 11:26 | |
just as `copy` | |||
tbrowder | ah, many thanks! | 11:32 | |
11:33
robertle left
11:34
jdv79_ is now known as jdv79
11:35
robertle joined
|
|||
pmurias | timotimo: perl6.github.io/6pad/#2c710afec97b...31fe38d803 - I made your spaceship drawing code run almost unmodified in the browser | 11:59 | |
timotimo | heck yeah! | ||
12:04
lgtaube left
12:09
wamba joined
12:11
wamba left
12:23
rindolf joined
12:25
pmurias left
12:42
robertle left
12:44
robertle joined
12:53
Cabanossi left
12:58
lucasb joined,
rindolf left
13:01
molaf left
13:06
wamba joined
|
|||
Doc_Holliwood | `:lang<JavaScript>`? What kind of dark wizardry is that again? | 13:13 | |
masak .oO( this is #perl6 -- we only dabble in light wizardry, not dark ) | 13:15 | ||
13:18
zakharyas joined
|
|||
Altreus | what the good heavens is this | 13:20 | |
this is definitely deep magic | 13:21 | ||
13:21
Sgeo__ left
|
|||
tadzik | hahah that's greart! | 13:21 | |
13:34
thowe left
13:40
rindolf joined
13:44
lgtaube joined
13:57
pat_js joined
14:07
pmurias joined
|
|||
pmurias | when wrapping a JS object in Perl 6 land I override some methods like .item so it can be used without jumping through hoops | 14:09 | |
what would be a good way when you want to actually use an js item method? | |||
I'm thinking of using a named argument like maybe :native/:raw | 14:10 | ||
so $foo.new would do a 'new $foo' in js land but $foo.new(:raw) would do '$foo.new' | 14:11 | ||
any thoughts about that? | |||
timotimo | could try with a .^ method | ||
pmurias | you mean with a .^call_js_method('new', |@arguments)? | 14:13 | |
timotimo | perhaps | ||
pmurias | that would work, but not sure if that's isn't too ugly | 14:16 | |
timotimo | i'm not sure under what circumstances you need to do one vs the other | ||
pmurias | if you have a js object that has a new or item method | 14:17 | |
and you want to call that | |||
14:17
isBEKaml left
14:18
shlomif joined
|
|||
vrurg | pmurias: I have basically done merging makefile templates for moar and jvm. But JS doesn't make sense until it bootstraps itself. | 14:19 | |
Altreus | I don't know what you're doing, making JS objects available to P6, but I hate-love it | 14:20 | |
pmurias | Altreus: I'm compiling Perl 6 to JS | 14:21 | |
vrurg: the nqp build system rarely changes right? so keeping the js stuff as is shouldn't cost us much? | 14:22 | ||
vrurg | pmurias: no. That's why I decided that cure would be worse than the illness in this case. :) | 14:23 | |
Altreus | successfully? This is definitely magic | ||
vrurg | Just keeping you posted. | ||
pmurias | Altreus: not everything works (and some things aren't really doable like multithreading stuff) but a large part of roast passes. The performance for now sucks | 14:25 | |
14:28
epony joined
|
|||
pmurias | timotimo: I'm not sure what a good named argument name would be | 14:38 | |
timotimo | at the very least it should be allcaps | 14:40 | |
14:44
wamba left
14:54
Cabanossi joined,
john_parr left
|
|||
pmurias | timotimo: :RAW? | 15:06 | |
timotimo | maybe? | 15:07 | |
:DIRECT? | 15:08 | ||
masak | :BLUNT | 15:12 | |
15:14
pmurias left
15:17
ufobat_ joined
|
|||
SmokeMachine | vrurg: don't you think a Event class would make it easier to `grep` it? | 15:18 | |
15:20
ufobat left
15:22
robertle left
|
|||
lizmat | and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2019/09/23/...else-itch/ | 15:28 | |
15:35
jmerelo joined
|
|||
Juerd | \o/ | 15:36 | |
masak | lizmat++ | ||
jmerelo | lizmat++ (always) | ||
15:38
p9s joined
|
|||
masak | aha, so TheDamian did the for-else in the way I first _thought_ the for-else worked in Python :P | 15:39 | |
15:39
domidumont left
|
|||
masak fondly remembers discussions with pmichaud and TimToady about this | 15:42 | ||
Altreus | still think "otherwise" would have been nicer | 15:45 | |
still could be :) | 15:47 | ||
lizmat | masak: could you give a gist of those discussions ? | ||
15:50
p9s left
|
|||
masak | lizmat: it must've been around 2009. I had recently learned about Python's for-else (and while-else) and thought it was nifty. crucially, I had misunderstood its semantics. | 15:52 | |
(in Python, the `else` triggers not on 0 iterations, but on the absence of a `break` (p6's `last`) statement | 15:53 | ||
) | |||
Altreus | what is this colon syntax? has Hidden:_ $!value; | ||
masak: wow... that sounds like the opposite of what else means | 15:54 | ||
masak | Altreus: the `:_` means "can be defined or undefined" or "can be a type object or an instance" | ||
Altreus | aha ... what is default? | ||
masak | Altreus: it actually makes sense, how Python does it | ||
Altreus: you just need the explanation to see it :) | |||
Altreus | Well | ||
Grinnz | naming is hard part 9000 | 15:55 | |
masak | `break` tends to signify "we found it, so no need to look further" | ||
Altreus | If I don't see the explanation I'll work on my understanding of English, which says that if I abort something (with break) then it "failed" | ||
ehhhh | |||
masak | and so the `else` means "in case we didn't find anything" | ||
Altreus | I don't like this at all :P | ||
masak | maybe it grows on one :) | ||
Altreus | I can tell we didn't find anything because there's nothing in the relevant variable :P | 15:56 | |
Grinnz | this seems more like perl5-"continue but only on the last iteration" | ||
Altreus | also that's very unlike a language that won't even let me test an assignment | ||
15:56
zakharyas left
|
|||
Altreus | or did they change that? Haven't done much python | 15:56 | |
Grinnz | isn't that why guido stepped down and all that? | 15:57 | |
Altreus | Anyway I would never have associated "break" with "we found it" | ||
masak | Altreus: yes, they changed that in 3.8 | ||
Altreus | Same way I don't associate "return" with "I succeeded" | ||
masak | Grinnz: yes, that was a direct cause | ||
lizmat | perhaps a NOTLAST phaser would then be more appropriate | 15:58 | |
to be fired if the for loop did *not* exit with a "last" | |||
still... easily enough coded :-) | 15:59 | ||
Altreus | Anyway, apparently for-else has different meanings in different places. And then with the other arguments for not using "else", I still propose "otherwise" instead :) | ||
Grinnz | i think it's even more fundamental than that - it's wanting to set a flag, and run an extra block if that flag didn't get set | ||
jnthn | lizmat: Those things get awkward scoping wise... | ||
Grinnz | it doesn't have to be tied to break/last | ||
Altreus | lizmat: but that could also mean "Not the last iteration", with also NOTFIRST | ||
for ... {} finally {} | |||
masak | lizmat: I remember the discussions had some consequences on the spec, so might be able to find logs for it. | 16:00 | |
16:00
wamba joined
|
|||
lizmat | yeah... although I kinda like "otherwise" | 16:00 | |
Altreus | finally would run only after the final iteration of the original list | ||
lizmat | for { } otherwise { } | ||
Altreus | Therefore if it was last'd, it wouldn't run | ||
Grinnz | i think otherwise is a great idea for that (apparently) different use case | ||
Altreus | otherwise would run if the original list was empty | ||
masak | lizmat: at least for a while, one could use the _value_ of a `for` loop to determine if it iterated at all | ||
Altreus | for @list { stuff } finally { I didn't find it } otherwise { empty list happened } | 16:01 | |
Grinnz | but in try/finally, the finally runs regardless of exception | ||
Altreus | yes, that one is a difficult word to find | 16:02 | |
a difficult case to find a word for | |||
Doc_Holliwood | how about `bare`? | 16:11 | |
16:11
robertle joined
|
|||
Doc_Holliwood | or just `empty` | 16:12 | |
Altreus | werl | ||
you could probably use a phaser for the "last iteration" jobby, so at the end of the last iteration you could do something else | |||
for @list { do stuff; LASTLY { oh I didn't find it } } otherwise { there was nothing in the list } | 16:13 | ||
FIRSTLY { this is the first iteration } | |||
but does LASTLY imply it should run when you do 'last' ? | |||
Doc_Holliwood | it pretty much implies at least some work has been done, not none | 16:14 | |
Altreus | it was meant to imply *all* the work has been done | 16:15 | |
jnthn | m: do for 1 { } or say "nope" | ||
camelia | ( no output ) | ||
jnthn | m: do for () { } or say "nope" | ||
camelia | nope | ||
Altreus | it was argued that the do/or construct is a bit overly separated | 16:16 | |
jnthn | m: do for 1 { if False { } } or say "nope" # alas... | ||
camelia | nope | ||
jnthn | What it actually tells you is not if you iterated anything :) | ||
Altreus | ah yes and it has to actually reutrn something | ||
something true | 16:17 | ||
jnthn | No, that's not the case | ||
It must produce something that's not Empty :) | |||
Altreus | aha, so many new concepts | ||
jnthn | m: do for 1 { False } or say "nope" | ||
camelia | ( no output ) | ||
Altreus | I guess the other thing I have to ask is, are people actually going to use 'for' like the python people do? | 16:18 | |
Surely we have better ways of hunting for things in lists than for/last | |||
Which means we don't even *have* the assumption that "The list ran out" is likely to mean "I didn't find it" | |||
and anyway we could use the word "exhausted" somehow | 16:19 | ||
masak | having spent some time with Pyhon's for-else (regardless of the actual semantics of it), I can say that I don't wish strongly for a for-else construct in the languages I use | 16:28 | |
I'm happy with doing the same with a boolean variable, or some slight repetition | 16:29 | ||
I mean, TheDamian writes compelling blog posts, but... :) | |||
in the end, I haven't found for-else or any other similar construct to be an improvement on clarity and at-sight understanding | 16:30 | ||
masak .oO( it's not a part of the Structured Programming dream ) | |||
Altreus | I have :O | 16:32 | |
and I think TT2 has one, or something like that | |||
16:32
scimon left
|
|||
Altreus | It's super useful for that sort of thing anyway | 16:32 | |
16:36
dakkar left
16:39
pat_js left
|
|||
Doc_Holliwood | Isn't monkey typing supposed to work with methods AND attributes? | 16:59 | |
In my toy code here it works for methods, but I cannot access the attribute | 17:00 | ||
pastebin.com/XxiAjhyr | |||
discord6 | <Aearnus> masak: for-else is useful for website templating | ||
<Aearnus> not how python does it though | |||
17:02
jmerelo left,
veesh joined
17:03
dogbert11 joined
|
|||
jnthn | Doc_Holliwood: You cannot add attributes to a class after composition time | 17:04 | |
Doc_Holliwood | yaaarrrgh. | 17:06 | |
Any other ideas of how to do this? | 17:07 | ||
subclassing `Proxy` didn't work either stackoverflow.com/questions/580553...rectly-tie | 17:08 | ||
17:08
Cabanossi left
|
|||
Doc_Holliwood | And the docs say "With augment, you can add attributes and methods to existing classes" | 17:09 | |
[Coke] | jnthn: you can trigger another compose, though, yes? | 17:10 | |
17:10
gabiruh joined
17:11
Itaipu joined
17:15
Cabanossi joined
|
|||
jnthn | [Coke]: Yes, perhaps more clear would be: only the first compose will compose attributes. | 17:17 | |
Doc_Holliwood: Then that'd be a doc bug; we've never supported adding attributes with augment | 17:18 | ||
Probably Proxy should become possible to subclass | 17:19 | ||
Doc_Holliwood | jnthn: allright, I will remove that from the docs then, yes? | 17:21 | |
jnthn | Doc_Holliwood: Yes, please | 17:25 | |
home time & | 17:28 | ||
Geth_ | doc: cf60fc2860 | holli-holzer++ (committed using GitHub Web editor) | doc/Language/variables.pod6 fixed: Attributes actually cannot be augment-ed. jnthn | Doc_Holliwood: Then that'd be a doc bug; we've never supported adding attributes with augment |
17:37 | |
synopsebot | Link: doc.perl6.org/language/variables | ||
17:37
cpan-p6 left
17:38
ChoHag left,
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined,
ChoHag joined
17:44
mowcat joined
17:47
nekomune left
17:52
aborazmeh joined,
aborazmeh left,
aborazmeh joined
17:53
kybr left
17:55
nekomune joined
17:59
kybr joined
18:03
rindolf left,
shlomif left
18:10
domidumont joined,
rindolf joined,
domidumont left,
shlomif joined
18:11
domidumont joined
|
|||
guifa wonders if he could do evil. And rewrite all of the keywords in a slang in Spanish, etc. | 18:21 | ||
18:21
domidumont left
18:29
El_Che left,
El_Che joined
18:31
ChoHag left
|
|||
Kaiepi | releasable6, status | 18:31 | |
releasable6 | Kaiepi, Next release in ≈26 days and ≈0 hours. R6 is down. At least 5 blockers. Unknown changelog format | ||
Kaiepi, Details: gist.github.com/57ec2d3230d4ac5b5a...1640357e73 | |||
18:32
ChoHag joined
18:33
wildtrees joined
18:34
Ven`` joined
|
|||
Doc_Holliwood | What will we do when we reach 6.z? | 18:41 | |
[Coke] | I'm sure we'll decide on that before 6.O | 18:43 | |
18:44
Maylay_ left
18:45
Maylay joined
18:48
khisanth_ left
18:53
aborazmeh left
|
|||
vrurg | Doc_Holliwood: Greek alphabet? Anyway, it's a problem to think about in a little bit over 40yrs from now. | 18:56 | |
19:02
khisanth_ joined
19:24
Xliff joined
|
|||
Xliff | . | 19:25 | |
\o | |||
19:25
wamba left
19:26
Itaipu left
19:28
aborazmeh joined,
aborazmeh left,
aborazmeh joined
19:29
Itaipu joined
|
|||
Kaiepi | i'm curious to see how people did the second task of last week's perl 6 challenge, subclassing Proxy doesn't work atm, mixing in roles to Scalar etc. didn't work when i tried it, and i couldn't think of a good way to override &infix:<=> | 19:39 | |
oh wait that's this week's one | 19:42 | ||
19:45
pmurias joined
|
|||
Doc_Holliwood | Kaiepi, my thoughts exactly | 19:55 | |
I also tried monkey-patching Proxy | 19:56 | ||
Kaiepi | the last way's probably the best bet, but i'm not sure how you'd keep track of which variable's which at compile time since you'd need a slang to do it | 19:57 | |
Doc_Holliwood | Well you can add methods but no attributes. You would have to keep a hash with adresses as keys or something, but you can have that with a bare closure | 19:58 | |
19:58
thundergnat joined
|
|||
Doc_Holliwood | It's a conspiracy to make Raku look bad | 19:58 | |
The question in the weekly | 19:59 | ||
thundergnat | Kaiepi: Take a look at rosettacode.org/wiki/History_variables#Perl_6 . The slightly unintuitive part is that Rakudo doesn't implement or allow a STORE method on a Scalar variable (for performance reasons) so it needs to be a sigiless var. | 20:01 | |
20:01
molaf joined
|
|||
thundergnat | That took me a while to figure out. | 20:02 | |
20:02
thundergnat left
20:05
wamba joined
|
|||
Kaiepi | does handles make it so calling one of the method names you give it on the instance of the class itself calls it on that attribute instead? | 20:08 | |
timotimo | yes | 20:09 | |
Kaiepi | neat | 20:10 | |
Doc_Holliwood | but not type safe | ||
20:13
Black_Ribbon joined
|
|||
Kaiepi | oh, it's not something i'd use then. everything i write is pretty strictly typed | 20:14 | |
20:15
fingolfin40 left
|
|||
timotimo | i'm not sure what that means, though? | 20:16 | |
20:19
aborazmeh left
20:35
pmurias left
20:38
pmurias joined
|
|||
Xliff | Doc_Holliwood: What do you mean by "not type safe"? | 20:40 | |
class A { method a (Int $b) { $b }; }; class C { has A $.d handles<b>; }; | 20:41 | ||
That replaces: | |||
class A { method a (Int $b) { $b }; }; class C { has A $.d; method a (Int $e) { A.a }; }; | 20:42 | ||
20:42
thowe joined
|
|||
Doc_Holliwood | for instance you cannot pass it into a function that expects an Int. Of course, it's a HistoryVar. I would like my (or the) solution more transparent | 20:44 | |
timotimo | "it"? | ||
Doc_Holliwood | The instance of HistoryVar | ||
timotimo | well, of course you can't | 20:45 | |
that would be not type safe | |||
it *is* type safe when it rejects a HistoryVar when it expects an Int | |||
Doc_Holliwood | fair. i used a wrong term. | 20:46 | |
timotimo | you can have many "handles" in your class | 20:47 | |
21:05
Ven`` left,
Ven`` joined
21:06
Ven`` left,
Black_Ribbon left,
sno left
21:07
Black_Ribbon joined,
sno joined
21:10
pmurias left
21:11
pmurias joined
21:22
sena_kun left
21:27
MasterDuke left
|
|||
Xliff | Would this work? --> class A { multi method a (Int $b) { $b }; }; class C { has A $.d handles <a>; multi method a (Str $e) { $e }; }; | 21:31 | |
m: class A { multi method a (Int $b) { "A: $b" }; }; class C { has A $.d handles <a>; multi method a (Str $e) { $e }; }; say C.new.a(1); C.new.a('Bleah') | 21:32 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Package 'C' already has a method 'a' (did you mean to declare a multi-method?) at <tmp>:1 |
||
Xliff | Well... that answers that. | 21:33 | |
Kaiepi | m: my Int:D @foo = (1,2,3); say @foo | 21:34 | |
camelia | [1 2 3] | ||
Kaiepi | m: sub foo(Int:D @foo) { say @foo }; foo (1,2,3) | ||
camelia | Type check failed in binding to parameter '@foo'; expected Positional[Int] but got List ($(1, 2, 3)) in sub foo at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
thowe | stuff like this saddens me: github.com/nunorc/p6-Pekyll | 21:35 | |
Kaiepi | why don't types for lists and hashes work the same in assignments vs function parameters? | ||
Xliff | thowe: Why? | ||
thowe | "Under heavy development, things will change.. you have been warned!" Latest commit 4 years ago. | 21:36 | |
Xliff | Oh. Yeah. That. | 21:37 | |
:( | |||
21:37
Kaiepi left
21:38
Kaiepi joined
|
|||
Xliff | Looks like he switched to python. | 21:38 | |
I think that would have been around the time of the Parrot vs Moar thingy. | |||
Kaiepi | which repo is this? | ||
Xliff | Kaiepi: Linked above. | ||
Kaiepi | oh, didn't see it | 21:39 | |
i wonder if there's a way you could make it so cro can handle it so you don't have to implement as much yourself | 21:40 | ||
Xliff | I would think Cro would be big help, there. | 21:41 | |
Kaiepi | i kinda wish more advanced stuff with cro like using pipelines was documented better though, its unit tests don't always show how you would be able to use stuff like that in your own code | 21:43 | |
there is the option to get training though | 21:44 | ||
tbrowder | hey #perl6 /o/ | 21:45 | |
thowe | hey tbrowder | 21:46 | |
tbrowder | some good writer needs to put a good article on cofeproject.com. last ar | ||
thowe: HOWdy | 21:47 | ||
21:47
go|dfish left
21:48
grumble left
|
|||
Doc_Holliwood | that name does not resolve. did you mean covfefeproject.com? | 21:48 | |
tbrowder | that's codeproject.com, could excite some people (i think they're mostly windows types. | ||
21:49
TreyHarris left
|
|||
tbrowder | the last perl articles i found on a search was looong ago | 21:49 | |
21:50
grumble joined
|
|||
Geth_ | ¦ problem-solving: Xliff assigned to jnthn Issue Delegation does not handle multi-methods. github.com/perl6/problem-solving/issues/107 | 21:57 | |
22:01
go|dfish joined
|
|||
jnthn | Kaiepi: Because function parameters are bound, not assigned | 22:02 | |
Kaiepi | ah, makes sense | ||
22:04
pmurias left
22:05
pmurias joined
|
|||
Kaiepi | i'm giving haskell a shot for the second time and it's so much easier to understand now after having used perl 6 | 22:06 | |
i like it a lot so far | 22:07 | ||
22:08
wamba left,
wamba1 joined
22:10
thowe left
|
|||
Xliff | Kaiepi: That's good! As long as we don't lose you to The Dark Side, it's all good! :) | 22:24 | |
Kaiepi | i'll always use perl 6 for scripting | 22:25 | |
Xliff | :> | ||
Elronnd | Kaiepi: I have a haskell book a friend gave me, keep meaning to learn it | 22:36 | |
wen tthrough the first chapter or so | |||
22:40
TreyHarris joined,
Sgeo joined
22:45
|oLa| left
22:54
pmurias left
23:05
wamba1 left
|
|||
wildtrees | Kaiepi, #haskell on freenode is pretty nice and there is #haskell-beginners as well | 23:37 | |
Elronnd | wildtrees: we're *on* freenode | 23:39 | |
wildtrees | just being very specific | ||
Kaiepi | yeah, i already joined #haskell | 23:40 | |
didn't know about #haskell-beginners though, will join that as well | |||
23:45
mowcat left
23:51
Xliff left
|