»ö« 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 maybe we should have asked rindolf to run the script with -Msnapper, that might've been interesting 00:00
jnthn I think on that Rakudo version, snapper didn't exit :) 00:01
*exist
timotimo oh, huh 00:02
committable6: releases use snapper
committable6 timotimo, gist.github.com/23a6d87442c8b03477...ad0ec50c11
timotimo amusing how "releases use snapper" sounds like "give me the releases that use snapper"
ah, one entry for each release because of different paths 00:03
2017.11 was the first one to have it
oh what
rindolf said "rakudobrew latest" ... perhaps that was the exact time we went from master to nom? 00:04
other way around*
AlexDaniel yes, possibly
00:05 Xliff_ joined, Xliff left, markong left
timotimo maybe it's time to turn nom into a branch that has a Configure.pl that is basically just "note 'the `nom` branch is no longer being used for rakudo. please switch over to `master` instead; exit 1" 00:06
00:18 cognominal joined 00:19 Geth left, Geth joined, ChanServ sets mode: +v Geth 00:20 agwind left, agwind joined 00:25 sharksoft joined 00:36 pharv left, pharv joined 00:40 pierre joined, skids joined 00:46 Actualeyes left
Xliff_ timotimo: Probably. 00:57
01:00 agwind left 01:01 agwind joined 01:04 Kaiepi left, Guest18 joined 01:06 Guest18 left 01:07 Guest18 joined 01:11 cdg_ joined 01:13 cdg__ joined 01:14 space joined 01:15 cdg left 01:16 cdg_ left 01:17 cdg__ left, space left 01:22 pharv left 01:23 pharv joined 01:28 pharv left 01:30 comborico joined 01:31 comborico is now known as comborico1611_ 01:36 pharv joined 01:37 pierre left, sharksoft left
comborico1611_ Which module is the most beginner-friendly for someone to read some simple programs? 01:37
(and not math intensive) 01:38
01:39 pierre joined 01:40 pharv left, pharv joined, pharv left, pharv joined
timotimo JSON::Tiny is rather simple, i think? 01:43
01:44 pharv_ joined 01:45 pharv_ left, pharv left, pharv joined
comborico1611 timotimo, thank you! 01:47
timotimo that could totally be a tag we put on distributions on the ecosystem 01:48
comborico1611 I don't yet know what JSON is but i am close to, in my learning it JavaScript.
I don't know what you are talking about, but I'm glad I could help.
01:49 Actualeyes joined
comborico1611 timotimo, it would be cool if there was a module specifically for beginners. 01:49
01:50 pharv left
comborico1611 And the community could simply dump they're simple programs into it, hopefully with adequate documentation. 01:50
Their*
APic k
timotimo well, we do have the examples page: examples.perl6.org/ 01:55
01:59 redhands left
comborico1611_ timotimo: thanks! 02:00
Off to bed. Goodnight, guys. 02:06
02:07 comborico1611_ left 02:09 comborico1611 left
skids wonders what could be done to make bits of Perl6 as effifcient as nqp so we could have less nqp:: things in src/core 02:10
APic yay
Took both Clones.
02:16 Lynx_ left 02:17 jeromelanteri joined 02:18 Lynx_ joined 02:33 konsolebox left 02:38 konsolebox joined 02:46 ilbot3 left 02:56 ilbot3 joined, ChanServ sets mode: +v ilbot3 02:57 jeromelanteri left 02:59 jeromelanteri joined 03:00 Guest18 left 03:01 Kaiepi joined 03:03 Guest18 joined 03:22 ufobat___ joined 03:26 ufobat_ left 03:42 leejo left 03:43 Actualeyes left 04:00 pharv joined 04:03 jeromelanteri left 04:05 jeromelanteri joined 04:37 konsolebox left 04:39 konsolebox joined 04:42 pierre left 04:43 pierre joined 04:47 pierre left 04:57 Cabanossi left 04:58 pierre joined 04:59 Cabanossi joined 05:01 Guest18 left 05:03 pierre left, Guest18 joined
perlawhirl bisectable6: say [^5+5] 05:05
bisectable6 perlawhirl, On both starting points (old=2015.12 new=c2d0d3a) the exit code is 0 and the output is identical as well
perlawhirl, Output on both points: «[5 6 7 8 9]␤»
perlawhirl seems that parses a bit odd. is there a reason for it?
found out because i was doing something like `@a[^$n+1]` and didn't get what I expected 05:06
need to disambiguate with `@a[^($n+1)]`
05:06 committable6 left
perlawhirl but I wonder the reason for the current result? 05:06
05:06 committable6 joined, ChanServ sets mode: +v committable6 05:07 pierre joined
AlexDaniel m: say (0..4) + 5 05:07
camelia 5..9
AlexDaniel m: say (0..4) * 2
camelia 0..8
AlexDaniel perlawhirl: ↑ that's the reason 05:08
(you can scale and shift ranges with math ops)
but even without that feature it wouldn't work anyway because of the precedence 05:09
c: 2014.01 say ^5+5
committable6 AlexDaniel, ¦2014.01: «10␤»
AlexDaniel ↑ that's a different way to do it
I mean compared to doing the range shift 05:10
perlawhirl ahh I see, i'm adding to a Range not an Int... fair enough
05:11 pierre left 05:14 xtreak joined 05:16 khw left 05:19 lizmat left 05:22 sno left 05:25 pierre joined 05:29 lizmat joined, pierre left 05:43 noganex left, pierre joined, skids left 05:45 Actualeyes joined 05:48 pierre left, curan joined 05:54 troys left 05:55 eliasr left 05:59 pierre joined 06:08 wamba joined 06:26 pierre left 06:27 pierre joined 06:31 pierre left 06:32 sno joined 06:42 pierre joined 06:47 pierre left 06:59 Spot__ is now known as Spot_, wamba left 07:01 pierre joined 07:06 pierre left 07:08 pierre joined 07:09 darutoko joined 07:15 espadrine left 07:28 noganex joined 07:34 domidumont joined 07:35 lizmat left 07:37 xtreak left 07:38 xtreak joined 07:39 domidumont left 07:40 xtreak left, domidumont joined, xtreak joined 07:46 lizmat joined 07:47 pierre left, pmurias joined 07:53 pierre_ joined 07:55 d4l3k_ joined, ChanServ sets mode: +v d4l3k_ 07:57 statisfiable6 left, benchable6 left, coverable6 left, mithaldu_ left, SourceBaby left, dalek left 07:58 mithaldu_ joined, d4l3k_ is now known as dalek 07:59 squashable6 left, shareable6 left, unicodable6 left, bloatable6 left, notable6 left, greppable6 left 08:00 abraxxa1 left, greppable6 joined, notable6 joined, bloatable6 joined, shareable6 joined, unicodable6 joined, squashable6 joined, releasable6 left, abraxxa joined, abraxxa left 08:01 quotable6 left, abraxxa joined 08:02 rindolf joined, abraxxa left 08:05 lowbro joined, lowbro left, lowbro joined 08:07 wamba joined 08:19 amalia___ joined, abraxxa joined 08:22 lizmat left 08:28 xtreak left 08:29 xtreak joined, abraxxa left 08:34 xtreak left 08:41 wamba left 08:45 AlexDaniel left 08:46 Guest18 left 08:48 abraxxa joined 08:49 lizmat joined 08:52 Guest18 joined 08:57 Anding joined, coverable6 joined, ChanServ sets mode: +v coverable6, benchable6 joined, statisfiable6 joined, ChanServ sets mode: +v statisfiable6
Anding Hello - I hope I might ask a question or two 08:57
08:57 quotable6 joined, ChanServ sets mode: +v quotable6, releasable6 joined
Anding loop (my $n = 0; $n < limit; $n++) { $s += $n} # Is $n visible to the code outside of this loop and {} 08:58
lizmat m: loop (my $n = 0; $n < limit; $n++) { $s += $n} ; $n 08:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$s' is not declared
at <tmp>:1
------> 3loop (my $n = 0; $n < limit; $n++) { 7⏏5$s += $n} ; $n
08:59 pharv left
lizmat m: my $s; loop (my $n = 0; $n < limit; $n++) { $s += $n} ; $n 08:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
limit used at line 1. Did you mean 'emit', 'list'?
08:59 xtreak joined
lizmat m: my $s; loop (my $n = 0; $n < 10; $n++) { $s += $n} ; $n 09:00
camelia WARNINGS for <tmp>:
Useless use of $n in sink context (line 1)
09:00 pharv joined
Anding $s was already declared. It's just a question about scope 09:00
lizmat m: my $s; loop (my $n = 0; $n < 10; $n++) { $s += $n} ; say $n
camelia 10
lizmat apparently it is :-)
Anding That's what I got - but that's quite counter-intuitive. loop( ) { } looks like a signature with {}, so I was expecting similar behaviour 09:01
lizmat "The initializer is executed once and any variable declaration will spill into the surrounding block." 09:02
on docs.perl6.org/syntax/loop
if you want visibility inside the block only:
Anding In C for(int i = 0 ; i < index ; ++i), i has no external visibility 09:03
lizmat for ^limit -> $n { }
09:04 dakkar joined, pharv left
Anding Fair enough... 09:04
lizmat that is also better optimnized :-)
09:12 sena_kun joined 09:20 zakharyas joined 09:21 jeromelanteri left 09:24 wamba joined 09:31 lizmat left 09:43 Guest18 left 09:47 Anding left 09:54 TEttinger left
pmurias what should NEXT {next} do? 09:57
10:01 pierre_ left, pierre_ joined 10:06 pierre_ left 10:10 lizmat joined
Ulti evaluate {next} and jump to the label of the string interp and then increment that loop counter and reenter? 10:17
at least thats what I would guess as an idiot glaring at code
possibly entering at the label rather than the start of the surrounding loop... though thats a bit jumpy
10:18 pierre_ joined
Ulti next feels more like it should only apply to loops though Id be surprised if it was also a goto 10:19
or is next a phaser for on next
which is sort of weird
10:22 pierre_ left
lizmat NEXT is the name of the phaser 10:28
m: for ^10 { NEXT .say }
camelia 0
1
2
3
4
5
6
7
8
9
lizmat m: for ^10 { NEXT .say; next }
camelia 0
1
2
3
4
5
6
7
8
9
jnthn It hinges on whether the call to the NEXT phaser is considered to be within the dynamic scope of the `next` control exception handler or not 10:29
And also what that even means
Neither is terribly good 10:30
10:31 pmurias left 10:36 pierre__ joined, pmurias joined
pmurias m: for ^5 {say $_; NEXT {say("next 1");next}} 10:37
camelia 0
next 1
next 1
1
next 1
next 1
2
next 1
next 1
3
next 1
next 1
4
next 1
next 1
pmurias Ulti: I was concerned about NEXT {next} inside a loop, but it seems to be behaving rather weird 10:38
10:43 Guest18 joined 10:45 Guest18 left 10:46 pierre__ left, pierre__ joined 10:47 lizmat left 10:51 pierre__ left 10:56 pmurias left 10:59 wbiker joined
wbiker hi all 10:59
I am not able to install rakudo star 2018.1 on Fedora 27 fresh installation. 11:00
perl Configure.pl --backend=moar --gen-moar --prefix=/opt/perl6 works
as well as make
make install failes with: 11:01
== Installing modules for MoarVM cd modules/zef && sh -c "PATH=/opt/perl6/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/wolfgangbanaston/.local/bin:/home/wolfgangbanaston/bin /opt/perl6/bin/perl6-m -Ilib bin/zef install ." ===> Testing: zef:ver<0.2.0>:auth<github:ugexe> ===> Testing [FAIL]: zef:ver<0.2.0>:auth<github:ugexe> Aborting due to test failure: zef:ver<0.2.0>:auth<github:ugexe> (use --force-test to override)
if I start all tests in /t they passes all. But not if the sh -c commadn is used. Any idea where the problem could be?
jnthn No, though I think if you run that command and give zef the --verbose flag or some such it will at least give a bit more info 11:03
11:03 breinbaas joined
rindolf hi all! moritz : [Coke] : with the latest rakudo/moar master mem consumption is acceptable. It runs slowly however 11:09
wbiker jnthn That might help, thx 11:18
11:19 zakharyas left 11:20 zakharyas joined
wbiker unfortunately, there is no --verbose flag. I could not find such flag in the help as well 11:23
El_Che wbiker: does your user has access to /opt/perl6 11:24
11:25 Actualeyes left
wbiker El_Che: thanks for helping. But of course. I tried both: installation with root in /opt and with user in ~/perl6. Both show the problem 11:26
El_Che wbiker: Weird. I build fedora 27 packages without trouble. I compile moarvm and nqp separedly though 11:27
11:28 raschipi joined 11:30 SyrupThinker joined
wbiker 2018.1 is out quite a while and just I have this troubles? Probably something is wrong with my box. But what could that be? 11:30
El_Che The rpm (github.com/nxadm/rakudo-pkg/releases) is built with this p5 sub: github.com/nxadm/rakudo-pkg/blob/m...udo.pl#L98
11:31 SyrupThinker is now known as Guest51578, Guest51578 left 11:32 SyrupThi` joined, SyrupThi` left
wbiker OK, I found the verbosity flag and started zef with --debug. That is what I got: 11:34
Seems too long string 11:35
SKIP: No Build.pm for zef:ver<0.2.0>:auth<github:ugexe> ===> Testing: zef:ver<0.2.0>:auth<github:ugexe> Testing with plugin: Zef::Service::Shell::Test+{<anon|51996944>} ===> Testing [FAIL]: zef:ver<0.2.0>:auth<github:ugexe> Aborting due to test failure: zef:ver<0.2.0>:auth<github:ugexe>
11:36 SyrupThi` joined, SyrupThi` left 11:40 markong joined
dogbert2 rindolf: that sounds like a step in the right direction at least :-) 11:40
rindolf dogbert2: yes 11:42
dogbert2 does it take ~10 minutes for you as well? 11:45
rindolf dogbert2: 13m 11:58
dogbert2: the p5 version and py3 take about 20s 11:59
dogbert2: pypy3 runs it under a second
dogbert2: so the performance of p6 is abysmal here 12:00
dogbert2 rindolf: sound as if there is room for some further optimizations in p6 :-)
I believe that one of the biggest culprits is array accesses, if memory serves timotimo has said that they are far from optimal 12:01
rindolf dogbert2: yes, but how long do we have to wait?
moritz rindolf: until it's done 12:02
rindolf: you know how volunteer-driven projects work, don't you?
dogbert2 do you know if numbers in p5 and python are 32-bit, 64-bit or larger? 12:03
moritz 64 bit, afaict 12:05
dogbert2 moritz: thx 12:06
moritz though python seems to have big ints too
dogbert2 are they used by default?
moritz 2**7000 gives a non-floating-point result
so it seems yes
dogbert2 cool
12:10 gregf_ left 12:11 Zoffix joined 12:15 Zoffix left 12:24 gregf_ joined 12:26 MilkmanDan left
Ulti feels tangibly faster to me in the shell if you sprinkle int64 on every variable in the code 12:27
I CBA to bench that though
12:27 scimon joined 12:28 MilkmanDan joined, wbiker left 12:29 zakharyas left 12:30 xtreak left
dogbert2 m: say "abcde" ~~ / ab <![e]> cde | ab.. / 12:32
camelia 「abcd」
12:33 xtreak joined
dogbert2 is this correct, there's an old RT claiming that it's not. What does moritz say. 12:33
moritz the <![e]> c should terminate LTM 12:36
so I think abcd is correct
let me reread S05
"So LTM completely ignores negative lookaheads, and continues to look for pure patterns in whatever follows the negative lookahead" 12:38
then it's wrong, and the ticket is right, and the match should be the whole string 12:39
12:46 riatre left 12:47 riatre joined 12:51 xtreak left 13:02 comborico1611 joined 13:14 eliasr joined 13:29 g- joined
dogbert2 moritz: thx, it's an oldie RT #122951 13:37
synopsebot RT#122951 [open]: rt.perl.org/Ticket/Display.html?id=122951 [BUG] negative lookahead doesn't LTM properly
moritz dogbert2: yes, still valid 13:39
and pmichaud is generally to be trusted with such issues :-)
(I learned much of my regex knowledge from him, jnthn++ and TimToady++) 13:40
13:40 cdg joined
moritz and Jeffrey Friedl's book, and "perlregex", and perlmonks 13:42
dogbert2 moritz: interesting, I have an old edition of Friedl and a new Perl 6 Regex book by some noname author :-) 13:46
13:54 pierre_ joined
timotimo rindolf: if i want to reduce the workload so i can profile changes more quickly, can i just change the "2.. 24" near the bottom to a shorter range? 13:54
13:55 curan left
rindolf timotimo: yes 13:56
Xliff_ Hi. Is there a perl6 equivalent option to perl5's -n"
Which is "assume program runs within a while <> {}" loop 13:57
scimon There's -n
-n run program once for each line of input
El_Che :) 13:58
[Coke] docs.perl6.org/language/5to6-nutsh...line_flags
El_Che I would have expected something more esoteric: perl6 -☔ 13:59
14:00 zakharyas joined
Xliff_ scimon++ # LOL -- missed that. 14:03
scimon :D 14:12
See the one I'd like is -E being a synonym for -e so when I flip between perl5 and perl6 on the commandline I get less confused.
timotimo we seem to spend rather a lot of time inside infix:<%> 14:13
moritz does it coerce anything?
14:16 aindilis left
timotimo m: say 14:16
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 3say7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an …
timotimo oops
m: say 1000000000.msb 14:17
camelia 29
timotimo the result values should fit into native ints, but the in-between values probably don't
the amount of time we spend in malloc and free is surprising 14:19
14:19 vcv joined
timotimo we spend a lot of time in mp_mul_2d, which we use for left shifts and creating big integer values from ints or nums 14:22
14:27 pmurias joined
[Coke] timotimo: digging into rindolf's slow code? 14:32
dogbert2 [Coke]: yep 14:33
14:39 gregf_ left 14:46 pierre_ left, pierre_ joined
pmurias jnthn: we do have tests for NEXT {last} which seems useful 14:47
jnthn: the way NEXT {next} behaves seems just weird and accidental 14:48
jnthn: do you think just implementing NEXT {last} and throwing an exception on NEXT {next} seems sane 14:49
?
I'm not sure if we want NEXT {redo} 14:50
14:52 skids joined, Actualeyes joined 14:57 aindilis joined, wamba left 14:59 abraxxa left
timotimo there was an easy win in the code from replacing @blah[1..*] with @blah.skip(1), but i didn't manage to improve much more 15:05
15:33 raschipi left, raschipi joined 15:38 pierre_ left 15:39 pierre_ joined 15:51 Xliff joined, Xliff_ left 15:56 pmurias left 15:59 wamba joined
jnthn .tell pmurias Exception is at lesat better than undefiend behavior. I suspect the oddness is becasue we're outside of the region covered by the next control handler of the loop in question, and so some other loop in the internals, which is in dynamic scope, catches it. 15:59
yoleaux jnthn: I'll pass your message to pmurias.
15:59 troys joined 16:04 bwisti left
Xliff Is there a way to format DateTime objects into arbitrary strings after initialization? 16:05
I don't have the luxury of specifying a formatter since I may not be the one instantiating the objects. 16:06
16:10 zakharyas left
jkramer You could just use the sub/callable that you'd use as formatter directly? 16:11
raschipi Xliff: Copy the data into another object and specify the formatter? 16:12
Xliff Or DateTime::Format?
16:15 aindilis left
jkramer m: DateTime.now.clone(:formatter(-> $_ { sprintf('custom formatter %04d', .year) })).print 16:16
camelia custom formatter 2018
16:16 bwisti joined, athenot joined
Xliff jkramer++ 16:23
Seems wasteful, though.
That and I need something better than what DateTime can do. For example: Properly formatted git dates, which need text DOW and MOY
DateTime only allows for index numbers.
At least as far as I can determine from the docs. 16:24
16:24 pmurias joined
jkramer DateTime::Format has strftime github.com/supernovus/perl6-datetime-format 16:26
daxim rakudo: use v6; class Foo { sub bar() { return 3 }}; say Foo::bar 16:28
camelia Could not find symbol '&bar'
in block <unit> at <tmp> line 1
daxim how to namespace? 16:29
jkramer m: class Foo { method bar { return 3 }}; say Foo.bar 16:30
camelia 3
jnthn daxim: Subs are my-scoped by default, stick an our on it to make it package-visible 16:32
daxim great, that does the trick 16:33
16:36 atta_ is now known as atta 16:38 lowbro left 16:45 john51 left
Xliff What's the best way to send this command using perl6? 16:47
pastebin.com/bt7cupGw
I'm using qq:x, but that's causing problems.
jkramer run 'git', 'filter-branch', '--env-filter', 'if [ ....' ? 16:48
16:49 john51 joined
jkramer With :out, :err if you want to capture the output 16:50
16:52 domidumont left 17:00 cdg left, cdg joined 17:05 cdg left 17:12 scimon left
pmurias jnthn: re better than undefined behavior, do we have any useful/sensible behavior for that? 17:13
yoleaux 15:59Z <jnthn> pmurias: Exception is at lesat better than undefiend behavior. I suspect the oddness is becasue we're outside of the region covered by the next control handler of the loop in question, and so some other loop in the internals, which is in dynamic scope, catches it.
17:27 lizmat joined
jnthn pmurias: I guess maybe "get me out of this NEXT phaser" or some such could work :) 17:31
17:32 domidumont joined 17:37 tt left 17:41 dakkar left 17:42 comborico1611 left 17:44 __semper__ left 17:49 cdg joined 17:50 amalia___ left, epony joined
pmurias jnthn: that would make sense but OTOH it might be better to just not allow something that's non-obvious and super rarely useful 17:51
jnthn pmurias: True 17:53
17:55 aindilis joined 17:59 AlexDaniel joined 18:14 char_var[buffer] joined 18:18 lizmat left 18:19 lizmat joined 18:30 lizmat left 18:35 adelyne left 18:40 epony left, xenotrope left 18:41 zakharyas joined, xenotrope joined 18:42 espadrine joined 18:43 lizmat joined 18:49 zakharyas left 18:51 darutoko left 18:52 pharv joined 18:55 lizmat left 18:57 lizmat joined 19:00 TEttinger joined 19:02 sno left 19:03 athenot left 19:05 athenot joined 19:09 lizmat left 19:12 cdg left
rindolf timotimo: hi 19:16
timotimo: any news?
19:19 lizmat joined 19:29 lizmat left 19:38 domidumont left 19:40 thunktone joined 19:42 pharv left 19:43 pharv joined 19:45 pharv left, pharv joined 19:49 evalable6 left, evalable6 joined 20:03 ZofBot left 20:06 pharv left, ZofBot joined, ChanServ sets mode: +v ZofBot 20:07 pharv joined 20:16 lizmat joined 20:25 lizmat left
timotimo rindolf: nothing really good 20:25
rindolf timotimo: ah. 20:26
Xliff rindolf: Just out of morbid curiosity, have you tried this in PHP?
timotimo rindolf: it gets faster if you replace @foo[1..*] with @foo.skip(1), for example
rindolf timotimo: well, good luck
timotimo: ah
timotimo rindolf: the numbers in the calculation before the % $BASE reach outside of 64 bit, don't they?
rindolf timotimo: no they dont 20:27
timotimo oh!
well, that changes everything
rindolf Xliff: not yet
Xliff: and doing numeric in php is evil
Xliff Yes. I did mention "morbid", didn't I? :)
rindolf Xliff: i did it in py2/3 perl5 and perl6 20:28
Xliff: yes
Xliff Yeah, I did read that.
Xliff laments he still hasn't bought moritz++ book yet. 20:29
rindolf timotimo: i think it exceeds 32-bit though 20:34
20:35 sno joined 20:43 cdg joined 20:50 quotable6 left, quotable6 joined 20:52 adelyne joined 20:54 pharv left 20:55 pharv joined, epony joined 21:00 pharv left 21:06 pharv joined, kurahaupo joined 21:08 pharv left, pharv joined 21:15 greppable6 left, greppable6 joined, ChanServ sets mode: +v greppable6 21:18 comborico1611 joined 21:20 raschipi left 21:22 pecastro_ left 21:23 Mithaldu left 21:25 wamba left 21:26 cdg_ joined 21:28 wamba joined 21:30 cdg left 21:31 Mithaldu joined 21:32 |oLa| joined 21:44 vcv left 21:49 pmurias left 21:50 cdg_ left 21:51 lancew joined 21:53 lancew_ joined
lancew_ Quick question, I am writing some tests that are time dependant. How do I set a fixed time for my tests? I.e. so something like "Date.new(DateTime.now);" can be set to a known good point so I can test date logic? 21:54
(can you guess that I have some tests that have broken as I look back at dates over 4 months and now my this year and last year dates don't work as I wrote the test in late 2017 when all was in "This year", now some is in "Last Year") 21:55
21:56 lancew left, rindolf left 21:58 lancew__ joined
moritz can't you just use relative dates when doing the comparison? 22:01
22:02 lancew_ left 22:04 skids left
lancew__ moritz, I am doing totals for this year and last year. But my test adds data with relative dates (i.e. this today, today -1 month, today -2 months, today -3 months, today - 13 months. Then has hard coded "expected" values for "this year" and "last year". Lazy I guess.... 22:04
lancew__ goes off to re-write
moritz lancew__: the other thing you could is to give the code an optional parameter for what to consider "today" 22:06
and default to Date.today()
but in the tests, you can pass in a hard-coded date
22:10 lancew__ left 22:14 Xliff left 22:22 Xliff joined 22:23 epony left, epony joined 22:26 aindilis left 22:39 wamba left 22:40 comborico1611 left 22:52 thunktone left 22:55 SourceBaby joined, ChanServ sets mode: +v SourceBaby 22:58 Grrrr left 23:02 lizmat joined 23:12 sivoais left 23:21 Grrrr joined 23:22 sena_kun left, Grrrr left 23:24 Grrrr joined 23:29 Grrrr left 23:31 Grrrr joined 23:32 pierre_ left 23:33 aindilis joined 23:38 pierre joined 23:42 pierre left 23:50 krunen_ joined, krunen left 23:51 krunen_ left 23:52 krunen joined