00:14
pawnbox has joined #crystal-lang
00:19
Philpax has joined #crystal-lang
00:19
pawnbox has quit [Ping timeout: 260 seconds]
00:35
pawnbox has joined #crystal-lang
00:38
onethirtyfive has quit []
00:39
pawnbox has quit [Ping timeout: 258 seconds]
00:43
Philpax has quit [Ping timeout: 252 seconds]
00:43
onethirtyfive has joined #crystal-lang
00:45
snsei has quit [Remote host closed the connection]
00:49
onethirtyfive has quit []
00:50
onethirtyfive has joined #crystal-lang
00:55
devinacosta has joined #crystal-lang
00:56
<
devinacosta >
I'm running into issue with Crystal, I'm trying to declare a Hash
00:56
<
devinacosta >
in ./src/vzcheck.cr:100: can't declare variable of generic non-instantiated type Hash(K, V) servers = uninitialized Hash
00:56
<
devinacosta >
I have tried: servers = Hash.new()
00:56
<
devinacosta >
Also tried: servers = Hash
00:56
<
devinacosta >
None of those work
00:58
devinacosta has quit [Client Quit]
00:58
<
havenwood >
devinacosta: An example would be: servers = {} of Symbol => String
00:58
devinacosta has joined #crystal-lang
00:59
onethirtyfive has quit []
01:00
<
devinacosta >
When i'm trying to create as hash variable that's empty i get:
01:00
<
devinacosta >
Syntax error in ./src/vzcheck.cr:100: for empty hashes use '{} of KeyType => ValueType' servers = {}
01:03
<
devinacosta >
I figured it out.
01:10
devinacosta has quit [Ping timeout: 250 seconds]
01:28
onethirtyfive has joined #crystal-lang
01:36
pawnbox has joined #crystal-lang
01:41
pawnbox has quit [Ping timeout: 260 seconds]
01:45
snsei has joined #crystal-lang
01:51
snsei has quit [Ping timeout: 244 seconds]
02:02
zenguyaz has joined #crystal-lang
02:12
pawnbox has joined #crystal-lang
02:14
Oliphaunte has joined #crystal-lang
02:16
pawnbox has quit [Ping timeout: 244 seconds]
02:21
<
zenguyaz >
If i have an hash that looks like : server = {"pcs1"=>["192.168.135.26", "10.241.146.231", "10.241.146.35"], "pcs2" => ["192.168.0.1","192.168.0.2"]}
02:21
<
zenguyaz >
is there an easy way if i pass the IP it tells me what key matches it?
02:51
pawnbox has joined #crystal-lang
02:52
<
havenwood >
zenguyaz: to get all of the keys with the ip you could do something like: server.select { |_, v| v.includes? ip }.keys
02:57
<
zenguyaz >
sweet thanks for that worked great.
02:59
pawnbox has quit [Ping timeout: 264 seconds]
03:11
Oliphaun_ has joined #crystal-lang
03:13
Oliphaunte has quit [Ping timeout: 240 seconds]
03:14
snsei has joined #crystal-lang
03:19
snsei has quit [Ping timeout: 240 seconds]
03:26
onethirtyfive has quit [Remote host closed the connection]
03:31
snsei has joined #crystal-lang
03:38
zenguyaz has quit [Ping timeout: 250 seconds]
03:44
Oliphaun_ has quit [Remote host closed the connection]
03:50
pawnbox has joined #crystal-lang
03:54
pawnbox has quit [Ping timeout: 250 seconds]
04:09
<
crystal-gh >
crystal/master f7fff74 Ary Borenszweig: Compiler: more refactors related to type and path lookup
04:15
onethirtyfive has joined #crystal-lang
04:16
onethirtyfive has quit [Remote host closed the connection]
04:23
Oliphaunte has joined #crystal-lang
04:41
pawnbox has joined #crystal-lang
04:45
pawnbox has quit [Ping timeout: 244 seconds]
05:02
pawnbox has joined #crystal-lang
05:03
Oliphaunte has quit [Remote host closed the connection]
05:06
pawnbox has quit [Ping timeout: 258 seconds]
05:49
snsei has quit [Remote host closed the connection]
05:51
snsei has joined #crystal-lang
05:53
snsei has quit [Remote host closed the connection]
05:53
snsei has joined #crystal-lang
05:53
onethirtyfive has joined #crystal-lang
06:22
onethirtyfive has quit []
06:28
ponga has joined #crystal-lang
07:01
ninja_ has joined #crystal-lang
07:01
<
ninja_ >
is there an easy way with crystal when i'm pulling webpage, to get the response time it took to load the page?
07:01
<
ninja_ >
response = HTTP::Client.get("#{url}") code = response.status_code body = response.body.lines
07:02
<
ninja_ >
i don't see any function that gives me response time.
07:03
snsei has quit [Remote host closed the connection]
07:12
ninja_ has quit [Quit: Page closed]
07:51
onethirtyfive has joined #crystal-lang
07:55
pawnbox has joined #crystal-lang
07:56
onethirtyfive has quit [Ping timeout: 244 seconds]
08:00
pawnbox has quit [Ping timeout: 276 seconds]
08:04
snsei has joined #crystal-lang
08:05
pawnbox has joined #crystal-lang
08:08
snsei has quit [Ping timeout: 240 seconds]
08:50
rolha has joined #crystal-lang
08:50
onethirtyfive has joined #crystal-lang
09:04
onethirtyfive has quit [Remote host closed the connection]
09:05
onethirtyfive has joined #crystal-lang
09:27
hangyas has joined #crystal-lang
09:28
onethirtyfive has quit [Remote host closed the connection]
09:38
willl has quit [Quit: Connection closed for inactivity]
10:34
snsei has joined #crystal-lang
10:39
snsei has quit [Ping timeout: 265 seconds]
11:08
zodiak_ has joined #crystal-lang
11:10
zodiak has quit [Ping timeout: 250 seconds]
11:30
ome has joined #crystal-lang
12:23
snsei has joined #crystal-lang
12:28
snsei has quit [Ping timeout: 258 seconds]
12:55
pawnbox has quit [Remote host closed the connection]
13:25
snsei has joined #crystal-lang
13:30
snsei has quit [Ping timeout: 260 seconds]
13:33
Oliphaunte has joined #crystal-lang
13:39
hangyas has quit [Quit: hangyas]
14:05
pawnbox has joined #crystal-lang
14:10
pawnbox has quit [Ping timeout: 258 seconds]
14:11
Oliphaunte has quit [Remote host closed the connection]
14:17
Oliphaunte has joined #crystal-lang
14:24
pawnbox has joined #crystal-lang
14:25
<
crystal-gh >
[crystal] BlaXpirit opened pull request #3070: Fixes for documentation generator (master...docs-fixes)
https://git.io/v6e0z
14:26
Oliphaunte has quit [Read error: Connection reset by peer]
14:27
Oliphaunte has joined #crystal-lang
14:28
pawnbox has quit [Ping timeout: 244 seconds]
14:30
Oliphaunte has quit [Remote host closed the connection]
14:30
Oliphaunte has joined #crystal-lang
14:40
snsei has joined #crystal-lang
14:50
<
crystal-gh >
crystal/master dd4fd7c Ary Borenszweig: Compiler: simplified a bit suggestions.cr
14:50
<
crystal-gh >
crystal/master 89fe6b7 Ary Borenszweig: Compiler: fixed path lookup relative to free variable
15:00
ome has quit [Quit: Connection closed for inactivity]
15:07
Oliphaunte has quit [Remote host closed the connection]
15:08
Oliphaunte has joined #crystal-lang
15:12
Oliphaunte has quit [Ping timeout: 260 seconds]
15:15
pawnbox has joined #crystal-lang
15:19
Oliphaunte has joined #crystal-lang
15:20
pawnbox has quit [Ping timeout: 244 seconds]
15:44
Oliphaunte has quit [Remote host closed the connection]
15:47
<
FromGitter >
<fridgerator> `s = ss.s` looks like its passing a value not a reference? just a guess, i’m new to the language
15:48
<
jhass >
I guess the question is how you model ss.s().a=(), as t = ss.s(); t.a=() or not
15:52
<
BlaXpirit >
well that really surprised me, it could be just an optimization bug or it could be intentional. strange either way
15:52
<
FromGitter >
<fridgerator> @BlaXpirit yeah it is strange
15:53
<
jhass >
well, it is convenient but inconsistent, yeah
15:53
<
jhass >
ss.@s.a=() should have that behavior
15:53
<
BlaXpirit >
where is the line where that stops working?
15:54
<
BlaXpirit >
and where is the documentation? we're not sure if it's not a bug, anyway
15:55
Oliphaunte has joined #crystal-lang
15:56
<
jhass >
that documentation is probably at asterite ;)
15:57
<
jhass >
huh, I see no difference?
15:57
<
BlaXpirit >
woops, my mistake
15:58
<
BlaXpirit >
it prints 0 0 on master!!!
15:59
<
BlaXpirit >
bleh, must be some weirdness with the playground
16:00
<
jhass >
prints 0 5 for me locally with both, 0.18.7 and master
16:01
<
BlaXpirit >
same for me, but playground does something weird
16:01
<
RX14 >
it makes sense to me, because when you set a property in a struct you modify the struct, but when you use = you copy the struct
16:02
<
RX14 >
then the = on the proeprty obviously doesn't update the S in the SS because it's been copied
16:02
<
BlaXpirit >
this has got to be an optimization bug
16:02
pawnbox has joined #crystal-lang
16:02
<
jhass >
well yes, the copy operation is on assignment and argument passing, not on return
16:03
<
jhass >
still that a.b.c = d isn't equivalent to t = a.b; t.c = d is a bit unexpected
16:03
<
jhass >
especially since whether b returns a class or struct should be rather opaque to the caller
16:03
<
RX14 >
a struct contains it's members
16:03
<
RX14 >
not refers to them
16:04
<
RX14 >
i know what i meant
16:04
<
RX14 >
a struct is embedded into it's container, right
16:04
<
RX14 >
so using dot notation just means you're setting memory inside the struct, but = means copy
16:04
<
BlaXpirit >
RX14 pls
16:05
<
RX14 >
now thats a bug
16:06
<
RX14 >
now thats weird
16:06
<
jhass >
it's the result of not clearly defined semantics
16:07
<
jhass >
I think we should just define chained dot as assignment to temporary variables and be done with it
16:07
<
BlaXpirit >
jhass, at this point i'm pretty sure they are well defined (simply always copy by value) but this goes against them due to a bug
16:07
<
jhass >
a.b.c should always be equivalent to t = a.b; t.c
16:08
<
RX14 >
thats weird tho
16:09
<
RX14 >
ss.s.a = 5 should work to me, as you're simply calling a method on the s in ss which updates it in-place
16:09
<
jhass >
I should say chained method calls
16:09
<
jhass >
no, ss.s.a = 5 is ss.s().a=(5)
16:09
<
jhass >
ss.@s.a = 5 should work in place
16:10
<
BlaXpirit >
however ss.s() should return a copy. which you then modify on the fly and it is discarded
16:10
<
RX14 >
hmmn i guess you're right
16:10
<
BlaXpirit >
at least thats what i expected when going into this
16:10
<
RX14 >
i'm used to langauges where proeprties aren't functions
16:11
<
RX14 >
properties being functions gets weird with structs
16:11
<
BlaXpirit >
and after comfirming that this doesnt work, my next step would be to suggest a rework of structs
16:12
<
BlaXpirit >
i mean, how often do you use private fields in structs? how often do you not have properties exactly matching members?
16:12
<
BlaXpirit >
my suggestion would basically be, when it comes to structs, s.a is equivalent to s.@a
16:12
<
jhass >
almost all iterators?
16:12
<
RX14 >
its an interesting suggestion
16:12
<
RX14 >
and i like it in a way
16:13
<
BlaXpirit >
then you can properly do the ss.s.a = 5 and whatever
16:13
<
RX14 >
well crystal could implement private properties
16:13
<
RX14 >
but the thing is it makes everything more complcated
16:14
<
RX14 >
because then you've really got 2 completely seperate semantics
16:15
<
RX14 >
i think it's something thats worth suggesting and making an argument for on github
16:15
<
BlaXpirit >
bleh, i wouldn't have private properties or functions in the first place, coming from python :p
16:16
<
BlaXpirit >
when it's half-assed, it isn't
16:16
<
RX14 >
sometimes i have a function that i need for my class
16:16
<
BlaXpirit >
i mean, C++ has "friend classes" and they are there for a reason
16:16
<
RX14 >
but really shouldn't be used outside it
16:16
<
RX14 >
same for properties
16:16
<
BlaXpirit >
sometimes i have a function that i need throughout my library but users don't need it - what do i do?
16:16
<
BlaXpirit >
public and :nodoc: :|
16:17
<
BlaXpirit >
this is even worse for macros
16:17
<
RX14 >
no but then you're intorducing an API
16:17
<
RX14 >
which can't be changed after 1.0
16:17
<
RX14 >
even if it's a messy implementation detail
16:17
<
RX14 >
private exists for a reason
16:17
<
BlaXpirit >
but I cannot use it
16:17
<
RX14 >
because it's liable to change
16:18
<
BlaXpirit >
it's an implementation detail but other classes need access to it
16:18
<
RX14 >
because it's private
16:18
<
BlaXpirit >
but they can't because it's private
16:18
<
RX14 >
but if other classes needed access i would make a clean api
16:18
<
RX14 >
but they dont
16:18
<
RX14 >
sometimes you need something messy
16:20
snsei has quit [Remote host closed the connection]
16:21
snsei has joined #crystal-lang
16:24
snsei has quit [Remote host closed the connection]
16:26
snsei has joined #crystal-lang
16:29
snsei has quit [Remote host closed the connection]
16:32
snsei has joined #crystal-lang
16:32
snsei has quit [Remote host closed the connection]
16:50
<
BlaXpirit >
made an issue about discussed topics
17:06
<
FromGitter >
<cjgajard> @BlaXpirit wasn't structs meant to be immutable? why you need that to be a struct instead of a class?
17:06
<
RX14 >
structs aren't meant to be immutable
17:06
<
RX14 >
they're meant to be pass-by-value
17:06
<
BlaXpirit >
cjgajard, it's not just about what I need
17:06
<
RX14 >
which makes them ineffective at storing mutable data over a long period
17:07
<
RX14 >
but they are still mutable, for example iterators
17:31
snsei has joined #crystal-lang
17:36
snsei has quit [Ping timeout: 265 seconds]
17:39
<
jhass >
as an additional overload, yes
17:41
<
RX14 >
would be nice if HTTP::Headers had a to_hash
17:42
<
RX14 >
probably from_hash too
17:42
<
FromGitter >
<acterhd> I heard bignumer very slow in crystal
17:43
<
FromGitter >
<acterhd> why?
17:43
<
jhass >
to_h and it actually has from Enumerable, so it's fine if you add an optimized version that just returns a copy of the internal one
17:43
<
RX14 >
where did you hear that acterhd?
17:43
<
jhass >
acterhd we're not too sure, we just bind libgmp, maybe not in an optimal manner in all cases yet
17:43
<
RX14 >
libgmp should be really fast
17:44
<
FromGitter >
<acterhd> I want also SIMD in Crystal
17:44
<
RX14 >
well of course big numbers are much slower than their native counterparts
17:44
<
RX14 >
because they aren't native to the cpu
17:54
<
RX14 >
jhass, should I type my callbacks as procs returning void, or returning nil? because i think procs typed to return nil fail if you accidentally have a value at the end
17:55
<
jhass >
just specify nothing
17:55
<
jhass >
alias Foo = A ->
17:56
<
RX14 >
you can do that?
17:56
<
jhass >
it's Void or Nil depending on Crystal version
17:58
Majost has joined #crystal-lang
18:21
<
BlaXpirit >
any way to take a screenshot of the whole screen and read the pixel data?
18:23
snsei has joined #crystal-lang
18:23
<
tilpner >
Can free variables in method definitions not occur in the return types?
18:23
<
BlaXpirit >
I don't understand
18:24
<
BlaXpirit >
tilpner, oh maybe i do. perhaps they can't. just don't specify the return type :/
18:31
<
tilpner >
But then how will I return an Array(T) without taking a T.class? :/
18:38
<
tilpner >
jhass - But only for a class with a free variable. What if I don't have one?
18:38
<
jhass >
I'm not sure what you're trying to do
18:39
<
tilpner >
jhass - Context: Returning an Array(T) from a crystal-db ResultSet, created by yielding to a T.
18:40
<
tilpner >
I can try writing out the type of the block, perhaps?
18:41
<
tilpner >
Indeed, I didn't think of that. This works better. :)
18:44
<
FromGitter >
<elorest> isn't there a way to chain each_with_index and reduce/inject together?
18:45
<
tilpner >
Is it possible to generate documentation for dependencies automatically, not just for the current shard, and easier than generating it manually for each lib?
18:46
<
BlaXpirit >
tilpner, just go into each folder and run crystal doc? i dont understand your use case
18:50
<
tilpner >
BlaXpirit - That's what I've been doing so far, but it'd be nicer to generate all of them automatically and merge them into one output.
18:51
<
tilpner >
(And I can't quite figure out how to generate docs for sqlite3)
18:51
<
BlaXpirit >
tilpner, btw it is probably better to literally merge them into one folder
18:51
<
BlaXpirit >
merge sources, then run crystal doc
18:54
<
FromGitter >
<elorest> @jhass Thanks. Not sure why it wasn't working for me.
19:00
snsei has quit [Remote host closed the connection]
19:02
<
tilpner >
Hmm, that seems annoying if done manually, but sounds easy to automate, so it might be fine. :/
19:07
soveran has joined #crystal-lang
19:07
soveran has quit [Changing host]
19:07
soveran has joined #crystal-lang
19:26
snsei has joined #crystal-lang
19:30
snsei has quit [Ping timeout: 244 seconds]
19:49
elomatreb has joined #crystal-lang
19:58
Oliphaunte has quit [Remote host closed the connection]
20:00
pawnbox has quit [Remote host closed the connection]
20:00
pawnbox has joined #crystal-lang
20:04
soveran_ has joined #crystal-lang
20:07
soveran__ has joined #crystal-lang
20:07
soveran has quit [Ping timeout: 250 seconds]
20:11
soveran_ has quit [Ping timeout: 244 seconds]
20:16
soveran__ has quit [Remote host closed the connection]
20:17
soveran has joined #crystal-lang
20:22
soveran has quit [Ping timeout: 240 seconds]
20:28
snsei has joined #crystal-lang
20:35
snsei has quit [Remote host closed the connection]
20:35
snsei has joined #crystal-lang
20:36
snsei has quit [Remote host closed the connection]
20:36
snsei has joined #crystal-lang
20:49
Oliphaunte has joined #crystal-lang
20:54
Oliphaunte has quit [Ping timeout: 244 seconds]
21:12
soveran has joined #crystal-lang
21:12
soveran has joined #crystal-lang
21:12
soveran has quit [Changing host]
21:24
soveran has joined #crystal-lang
21:24
soveran has quit [Changing host]
21:24
soveran has joined #crystal-lang
21:31
onethirtyfive has joined #crystal-lang
21:32
onethirtyfive has quit [Client Quit]
21:33
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
21:38
snsei_ has joined #crystal-lang
21:40
snsei has quit [Ping timeout: 252 seconds]
21:44
Oliphaunte has joined #crystal-lang
21:49
Oliphaunte has quit [Ping timeout: 264 seconds]
21:57
<
crystal-gh >
crystal/master 8034212 Ary Borenszweig: Fixed #3071: detect recursive structs via subtypes
22:25
<
RX14 >
jhass, I added the unhandled fields callback, anything more to get multipart merged?
22:25
<
jhass >
looks good from my side, but enough code to warrant a second opinion ;)
22:26
<
RX14 >
BTW, I think we should seperate HTTP::Request into a server and client class
22:26
<
RX14 >
response already does that
22:26
<
RX14 >
and making request act like an IO is much saner that way
22:39
snsei has joined #crystal-lang
22:41
snsei_ has quit [Ping timeout: 260 seconds]
22:53
bjz has joined #crystal-lang
23:02
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
23:05
pawnbox has quit [Ping timeout: 264 seconds]
23:08
matp has quit [Remote host closed the connection]
23:32
Oliphaunte has joined #crystal-lang
23:37
Oliphaunte has quit [Ping timeout: 276 seconds]
23:54
soveran has quit [Remote host closed the connection]