RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <j8r> 8*1024 do the job @vladfaust
<FromGitter> <dscottboggs_gitlab> well, for more generic use case, you could do 8 << 10 but I agree that it makes sense to have 8.kb as well
<FromGitter> <j8r> Monkey patching Int is a bad idea
<FromGitter> <dscottboggs_gitlab> I agree, I think it should be a part of Int
<FromGitter> <j8r> I see the usefulness of having a lib to convert MiB to MB to Mb
<FromGitter> <j8r> It should be a shard
<FromGitter> <dscottboggs_gitlab> idk having a shard for shifting by multiples of 10 and multiplying/dividing by 8 seems like a fast-track to node's dependency insanity. but there's already Int.second etc, why wouldn't there by an Int.kb/mb etc
faitswulff has joined #crystal-lang
moei has joined #crystal-lang
non-aristotelian has quit [Quit: non-aristotelian]
<FromGitter> <Blacksmoke16> @vladfaust https://github.com/crystal-lang/crystal/pull/6314
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <mwean> Let's say I have a yaml document that I know is a Hash(String, Int), is there any way to express that so I don't have to do something like iterate over it first?
<FromGitter> <mwean> I'd like to be able to do โŽ โŽ `````` [https://gitter.im/crystal-lang/crystal?at=5bb425435af4853068513387]
<FromGitter> <dscottboggs_gitlab> `YAML.parse("string").as(Hash(String, Int32))
<FromGitter> <dscottboggs_gitlab> also you could create a YAML.mapping class
<FromGitter> <mwean> oh wow
<FromGitter> <mwean> awesome
<FromGitter> <mwean> I tried a bunch of combinations of `as` and `as_h` but they didn't work
<FromGitter> <mwean> thanks!
faitswulff has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> hm, maybe that won't work then?
<FromGitter> <dscottboggs_gitlab> idk
<FromGitter> <mwean> no it did!
<FromGitter> <dscottboggs_gitlab> oh cool!
<FromGitter> <mwean> also I didn't know about the mapping class
<FromGitter> <mwean> very cool
<FromGitter> <dscottboggs_gitlab> oh yeah, it really makes working with JSON/YAML pretty nice
faitswulff has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.26.1/YAML/Serializable.html is the perfered way, over YAML.mapping iirc
<FromGitter> <mwean> oh cool
<FromGitter> <mwean> thanks!
faitswulff has joined #crystal-lang
<FromGitter> <Blacksmoke16> np
rohitpaulk has quit [Ping timeout: 268 seconds]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> i reduced my example https://play.crystal-lang.org/#/r/558b
<FromGitter> <girng> why doesn't my position.x get updated?
<FromGitter> <girng> i was looking at https://crystal-lang.org/docs/syntax_and_semantics/operators.html and i created my own `+` operator
<FromGitter> <dscottboggs_gitlab> yeah, what the hell?
<FromGitter> <girng> check here, it changes if i do just `= ` https://play.crystal-lang.org/#/r/558n
<FromGitter> <dscottboggs_gitlab> your operator defintitions don't actually apply in this case
<FromGitter> <dscottboggs_gitlab> That's for adding a vector to a vector, you're adding an into to a vector's coordinate
<FromGitter> <girng> o
<FromGitter> <dscottboggs_gitlab> but I would still think it would work? I'm just saying your example can be reduced further
<FromGitter> <girng> i just tried https://play.crystal-lang.org/#/r/558p
<FromGitter> <girng> it works! maybe the += is bugged for structs?
<FromGitter> <dscottboggs_gitlab> https://play.crystal-lang.org/#/r/558r
<FromGitter> <dscottboggs_gitlab> this invokes your operator and does what you intended
<FromGitter> <girng> sweet, thanks again
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 252 seconds]
francisl has quit [Quit: francisl]
<FromGitter> <mwean> Hmm I'm having more yaml troubles
<FromGitter> <mwean> I'd like to use `YAML::Serializable`, but I don't know what the keys will be
<FromGitter> <mwean> I just know it's a hash of string => string
<FromGitter> <mwean> and I'm getting `can't cast YAML::Any to Hash(String, String)`
<FromGitter> <mwean> even though I swore that worked before...
<FromGitter> <mwean> I can do `YAML.parse(yaml).as_h.map { |k, v| [k.as_s, v.as_i] }.to_h`, but the type of that is coming out as `Hash(Int32 | String, Int32 | String)` ๐Ÿ˜•
<FromGitter> <rishavs> Just saw the updated results at https://github.com/the-benchmarker/web-frameworks โŽ Why is spider-gazelle at least 4 times faster than the next fast crystal framework?? o.0
<FromGitter> <rishavs> Specially considering they use the same builtin Http::Server
<FromGitter> <bew> @mwean don't use `YAML.parse`
<FromGitter> <bew> For your usecase you can do `Hash(String, String).from_yaml(some_yaml)`
<FromGitter> <mwean> ๐Ÿ˜ฎ
<FromGitter> <mwean> that's awesome, thanks!!
<FromGitter> <bew> @dscottboggs_gitlab oh right sorry, unix sockets are supported in `HTTP::Server` but not yet in `HTTP::Client`.. It seems
<FromGitter> <bew> @straight-shoota do you plan on adding this?
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <bew> @mwean `YAML.parse` & `JSON.parse` are the kind of things that you should almost never use unless you have no other choice
<FromGitter> <dscottboggs_gitlab> @bew thanks, I'll just use TCP for now. :)
<FromGitter> <rishavs> ok found out that spider-gazelle is using process clustering/workers. https://github.com/spider-gazelle/action-controller/blob/master/src/action-controller/server.cr#L71 โŽ that is surprisingly simple!
pabs has quit [Ping timeout: 244 seconds]
<FromGitter> <mwean> That's good to know ๐Ÿ‘
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> @bew if structs are generated on the stack, does that mean if i were to use them in a game loop, could i possibly get a stack overflow error?
faitswulff has joined #crystal-lang
<FromGitter> <girng> i'm just trying to understand the struct vs class stuff more. for example, if you look here: https://play.crystal-lang.org/#/r/5593, the `+=` does not work if it's a `struct`. but if i were to change that `struct` to a `class` it works just fine
<FromGitter> <girng> or, i could use d scott bogg's solution but i'm puzzled on why this is like this
<FromGitter> <bew> Structs are passed by copy, so doing `new_player.position` will get you a copy of the vector..
<FromGitter> <girng> "are passed by" meaning accessing it, or only by passing it as a parameter to another method?
faitswulff has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> @girng #4933
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
<FromGitter> <girng> i have an idea about a solution, can i post it there?
<FromGitter> <bew> Sure
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> i'm just going to use a class, holy smokes batman!!
<FromGitter> <bew> If you're worried about the gc using precious time to allocate all these little classes, i may have a solution to pre-allocate a lot of them in 1 gc call, i have a working poc of this
<FromGitter> <bew> But it's a hack of the type system in Crystal..
<FromGitter> <bew> As in: i create a class from a pre-allocated (uninitialized) memory area
<FromGitter> <girng> @bew i need to make an example of something was going to ask u but i figured if i make it in code it's better explained
<FromGitter> <girng> @bew here: https://paste.ee/p/w2UXB my memory usage stays at 0.0 it doesn't even go up at all. but i'm passing the struct's by copy (duplicating), and creating a new Hash (heap memory allocation!) every new tick.
<FromGitter> <bew> What are you trying to show?
<FromGitter> <girng> in my mind this constitutes as a memory leak and i don't even see any increase in memory usage in `top` or `htop`
<FromGitter> <girng> i don't understand why it's NOT leaking memory
sevensidedmarble has quit [*.net *.split]
davic has quit [*.net *.split]
robacarp has quit [*.net *.split]
maxpowa has quit [*.net *.split]
<FromGitter> <bew> Btw for those interested in my hack, you can see it here https://gist.github.com/bew/b816c76613574389445ba43b8f7110eb
<FromGitter> <bew> @girng you're not storing the hash, or saving it somewhere, you use the same variable to save all the hashes, so basically when you re-assign the var, the previous hash becomes unreachable, and will be gc-ed
robacarp has joined #crystal-lang
<FromGitter> <girng> so basically each iteration, it's re-assigning the new hash and freeing up the previous ones memory space?
<FromGitter> <bew> It's not immediately deallocated
maxpowa has joined #crystal-lang
davic has joined #crystal-lang
sevensidedmarble has joined #crystal-lang
<FromGitter> <bew> But yes that's the general idea
<FromGitter> <girng> ty 4 help
<FromGitter> <girng> i feel more confident
<FromGitter> <bew> Yw ;)
baweaver is now known as baweaver_away
<FromGitter> <girng> im really loving the built in benchmarking , so easy..
<FromGitter> <girng> https://paste.ee/p/aTc5d โŽ โŽ ```code paste, see link``` โŽ โŽ why is from_json slower? i thought from_json was the correct way? [https://gitter.im/crystal-lang/crystal?at=5bb4756e435c2a518e445d63]
sevensidedmarble has quit [*.net *.split]
davic has quit [*.net *.split]
maxpowa has quit [*.net *.split]
davic has joined #crystal-lang
faitswulff has joined #crystal-lang
sevensidedmarble has joined #crystal-lang
maxpowa has joined #crystal-lang
<FromGitter> <j8r> from json on which object?
faitswulff has quit [Ping timeout: 250 seconds]
<FromGitter> <j8r> Your serialize with from_json, not with JSON.parse which produces JSON::Any
<FromGitter> <girng> TEXT
<FromGitter> <girng> i thought json.parse shouldn't really be used
<FromGitter> <girng> but if from_json is slower than json.parse, i don't know what to do
<FromGitter> <j8r> but from_json is called from an object
<FromGitter> <bew> @girng but you don't get the same data output, you still need to do some transformation from the json any to get your hash, try benching that too
return0xe has joined #crystal-lang
<FromGitter> <j8r> https://carc.in/#/r/559v
<FromGitter> <j8r> they can't be compared
<FromGitter> <j8r> add `as_h` at least
<FromGitter> <girng> ohhh
<FromGitter> <girng> oops yeah
return0e has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> im benching more
<FromGitter> <girng> new code: https://paste.ee/p/bxY4N โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb4813ac7bf7c3662ab55c4]
<FromGitter> <girng> ok i found a change
<FromGitter> <girng> https://paste.ee/p/Vgili
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb4827c3844923661d8e8e2]
<FromGitter> <girng> now from_json is faster =]
sevensidedmarble has quit [*.net *.split]
maxpowa has quit [*.net *.split]
ashirase has quit [Ping timeout: 244 seconds]
maxpowa has joined #crystal-lang
sevensidedmarble has joined #crystal-lang
ashirase has joined #crystal-lang
<FromGitter> <j8r> why this doesn't return the current epoch time? https://carc.in/#/r/55ac
<FromGitter> <bew> I don't get it, what do you expect to get?
<FromGitter> <j8r> having the epoch time, the time since the UNIX epoch
<FromGitter> <j8r> which is 1970/01/01
<FromGitter> <straight-shoota> @bew The HTTP client needs a lot of improvements, Unix sockets are just one of them. It needs some progress on #6011
<FromGitter> <straight-shoota> @j8r take a look at what `Time::Span#seconds` returns: `the number of full seconds of the minute (0..59) in this time span.`
<FromGitter> <straight-shoota> You're looking for `#total_seconds`
<FromGitter> <bew> @straight-shoota I thought so too
<FromGitter> <bew> @j8r there's also `Time#epoch`
<FromGitter> <j8r> duration since the unix epoch date. Commonly in seconds, but we may want also milliseconds or days
<FromGitter> <j8r> thanks @straight-shoota
<FromGitter> <girng> Time.now.epoch_ms?
<FromGitter> <j8r> @girng The purpose is to replace all this `#epoch` methods by a single one `to_unix`
<FromGitter> <girng> oh ic
<FromGitter> <j8r> which would return a `Time::Span` since 1970/01/01, according to https://en.wikipedia.org/wiki/Unix_time
<FromGitter> <sdogruyol> Yo ๐Ÿ‘‹
<FromGitter> <bew> \o/
<FromGitter> <j8r> @sdogruyol hi!
<FromGitter> <straight-shoota> @j8r That's essentially #6662
<FromGitter> <j8r> @straight-shoota yes but you are adding a lot more methods, for something that already exists : UNIX epoch is a `Time::Span` by essence
<FromGitter> <straight-shoota> That's true
<FromGitter> <straight-shoota> The question is, should it be expressed as `Time::Span` or a simple integer (which is commonly used for Unix timestamps).
<FromGitter> <straight-shoota> It simplifies the API avoiding several methods for different return types. That's definitely a plus.
<FromGitter> <j8r> second and milliseconds are the most widespread, yes. But there are also epoch days in some places, like in `/etc/shadow`
<FromGitter> <straight-shoota> Such use cases are of minor relevance, since it is super easy to implement a special case yourself.
<FromGitter> <j8r> Then some will finally end up by creating a `Time::Span` :/
<FromGitter> <straight-shoota> Looking at the use cases in stdlib, it usually expects an integer, thus `to_unix` would need to be changed to `to_unix.total_seconds`.
<FromGitter> <straight-shoota> That's a little more verbose, but probably okay.
<FromGitter> <straight-shoota> But using the `Time::Span` in between also adds some overhead in terms of additional calculations including nanoseconds.
<FromGitter> <straight-shoota> I'm not sure that can be justified by a simplified API... Getting the number of seconds since Unix epoch as integer is by far the most common use case and it is implemented as a simple integer subtraction. Putting a `Time::Span` in between adds some complexity that is often not necessary.
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> @straight-shoota maybe a `Time::Duration` like https://doc.rust-lang.org/std/time/struct.Duration.html ,which only have total seconds, milliseconds etc
<FromGitter> <straight-shoota> That's essentially the same as `Time::Span`.
<FromGitter> <j8r> but only with `#total_`, and the base unit is nanoseconds. There are multiplications to convert them to milliseconds, seconds etc
<FromGitter> <j8r> oh yes, this methods are in Time::Span
<FromGitter> <straight-shoota> That doesn't change anything. `#seconds` etc. just calculate the units from the `total_seconds`/`nanoseconds`
<FromGitter> <j8r> yes
<FromGitter> <j8r> so the main point is less performance?
<FromGitter> <straight-shoota> I've run a simple benchmark, and it doesn't seem to have much of an impact
<FromGitter> <straight-shoota> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb49616ef4afc4f28105d60]
<FromGitter> <straight-shoota> It's not even consistent which one is faster
<FromGitter> <j8r> I'm wondering, we'll also need a `#from_unix` if we have `to_unix`
<FromGitter> <straight-shoota> `Time.unix` as proposed in #6662 with an overload accepting `Time::Span`
<FromGitter> <straight-shoota> Could be `.from_unix`, not sure if that matters
<FromGitter> <straight-shoota> I wrapped the benchmark in loops of 1000 iterations, and it shows `#to_unix` more consistently about 10% faster than `#epoch`. Which seems odd. Might be some strong optimization.
<FromGitter> <j8r> ?! ๐Ÿ˜ฎ
<FromGitter> <j8r> Despite having big performance difference, for me correctness is the more important aspect
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <straight-shoota> None of both approaches is more "correct" than the other
<FromGitter> <vladfaust> Hello, could you please answer this question: if I'm a freelancer, can I create easy-to-distribute binaries of Crystal apps without revealing source code?
<FromGitter> <vladfaust> And ship the to my clients
<FromGitter> <straight-shoota> Sure. A binary never contains source code.
<FromGitter> <vladfaust> I mean this static linking stuff
<FromGitter> <vladfaust> Once a binary built on my Ubuntu, can it be used on a client's machine?
<FromGitter> <rishavs> Can anyone give a short example of making a json out of an array using to_json?
<FromGitter> <vladfaust> > Once a binary built on my Ubuntu, can it be used on a client's machine? โŽ โŽ I assume no because there could be libs mismatch, right?
<FromGitter> <rishavs> wouldn't the libs themselves be compiled into the binary?
<FromGitter> <rishavs> as long as the cpu architecture is the same, you should be able to use the binary
<FromGitter> <vladfaust> I want approval of this from other users as well, thanks @rishavs
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> @vladfaust better to build on Alpine Linux
<FromGitter> <vladfaust> @j8r, would that work in client's Ubuntu machine?
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <j8r> The only requirement is to have a libc not ancient, because calls may not exists. Maybe for systems with kernels like 2.6.x ,not sure
<FromGitter> <j8r> If you have 3.x or 4.x, the libc isn't a problem for sure
<FromGitter> <vladfaust> Wouldn't I experience issues with OpenSSL bindings?
<FromGitter> <j8r> No, everything is on the binary :)
<FromGitter> <vladfaust> Asome
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> This also simplify deployments
<FromGitter> <vladfaust> I believe so
<FromGitter> <vladfaust> However been using Dokku with Dockerfile build for my projects
<FromGitter> <vladfaust> But working with clients need another approach I guess
<FromGitter> <j8r> Hum @straight-shoota , you may have text in a binary. for example `head /bin/sh`
<FromGitter> <vladfaust> BTW, regarding to licensing. Apart from Ruby when source is always shipped, there can be a separate licensing model for Crystal shards - use in a developer team based on amount of employees and ship built binaries to any amount of clients
faitswulff has joined #crystal-lang
<FromGitter> <straight-shoota> @j8r Yeah, binaries contain symbol names and stuff. But (Crystal) binaries don't contain source code.
rohitpaulk has quit [Ping timeout: 246 seconds]
[spoiler] has joined #crystal-lang
<FromGitter> <j8r> @straight-shoota false. `grep -aoP '(?<=<).*(?=html>)' /usr/lib/crystal/bin/crystal`
[spoiler] has quit [Client Quit]
[spoiler] has joined #crystal-lang
<FromGitter> <j8r> html is put in the binary as text for example. At the end all is binary, but this portion represents text
<FromGitter> <straight-shoota> What? That's embedded HTML source code. It doesn't contain it's own Crystal source code.
<FromGitter> <j8r> So crystal binaries may contain text, but not Crystal source code as text
DTZUZO has joined #crystal-lang
<FromGitter> <straight-shoota> They may also contain Crystal source code as text. But not their *own* source code. (Unless explicitly embedded)
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
<FromGitter> <straight-shoota> I can't edit wiki pages anymore. Has there been a change to access rights?
faitswulff has quit [Remote host closed the connection]
francisl has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> I like the idea of having `Time#to_unix` return a `Time::Span`, which can then be used to get the necessary granularity. Perhaps it could have a `#to_i` which returns the seconds? Or would that be confusing since it actually refers to the particular nanosecond value?
<FromGitter> <j8r> @dscottboggs_gitlab by returning a `Time::Span`, you can have all this method https://crystal-lang.org/api/master/Time/Span.html
<FromGitter> <j8r> `#to_i` would be confusing. there is already `total_seconds`, `total_milliseconds` etc
<FromGitter> <dscottboggs_gitlab> it already has `#to_i`
<FromGitter> <dscottboggs_gitlab> ?
<FromGitter> <j8r> So no problem :) (still think it's confusing, another topic)
<FromGitter> <j8r> the worst is `#to_f`, which is also an alias to `#total_seconds`
<FromGitter> <j8r> noo :( `p 1_u16 <=> 25_u16 #=> -1`
<FromGitter> <j8r> 1) I mean `p 1_u16 - 25_u16`
<FromGitter> <j8r> Indeed it overflow
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 252 seconds]
faitswulff has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter> <yxhuvud> @straight-shoota perhaps the rights was changed in response to the spammers?
faitswulff has quit [Remote host closed the connection]
<FromGitter> <codenoid> #6900 hmmm
faitswulff has joined #crystal-lang
wuehlmaus has left #crystal-lang ["Aus, die Maus"]
[spoiler] has quit [Quit: Cheers!]
[spoiler] has joined #crystal-lang
[spoiler] has quit [Client Quit]
[spoiler] has joined #crystal-lang
faitswulff has quit []
<FromGitter> <proyb6> Have any of your Crystal app get audit by your Auditors or clients, I wonder what they are usually looking for
<FromGitter> <bararchy> @proyb6 What do you mean by "audit"? security or technical due diligence
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
<FromGitter> <proyb6> @bararchy On security side which I see most organisations have legacy applications with huge codebase wrote in PHP on an legacy web framework like Yii1 EOL is on 2020, how does one encourage the team to adopt alternative language like Crystal if they can reduce code complexity?
<FromGitter> <bararchy> @proyb6 Security side is mostly bussines-logic and application level vulenrabilties, such as OWASP top 10 (XSS,SQLi,etc..) and things like Authentication bypass, access to unauthorized data via user id manipulation, cookie manipulation (injections, xss and session fixation) โŽ Those things are languge agnostic and depends more on the application logic and tech stack
<FromGitter> <codenoid> it's depend on your code
<FromGitter> <bararchy> ^ exactly
<FromGitter> <drum445> Do you guys see many use cases for interfaces/abstract classes?
<FromGitter> <proyb6> @bararchy I see, true is depend on our code, I think we need some articles on writing the secure app with Crystal after seeing too many introductions about Crystal.
<FromGitter> <drum445> If you're creating a web app, kemal-session and the default sql library is a good place to start.
<FromGitter> <bararchy> @proyb6 Well, it can be a nice writeup, maybe I'll try to do something, but it mostly revolves around "don't re-invent security features" and use common tools and configurations that have been proven
<FromGitter> <drum445> You do see a lot of people trying to rewrite things that have already become industry standards
<FromGitter> <proyb6> Awesome, thatโ€™s a good ones
<FromGitter> <straight-shoota> > use common tools and configurations that have been proven โŽ And that needs people talking about it
<FromGitter> <bararchy> @straight-shoota true, I can say that as of now, we have tested multiple features of Crystal both Core and Kemal for sec issues, and posted and fixed anything we found
<FromGitter> <straight-shoota> ๐Ÿ‘
<FromGitter> <straight-shoota> Yeah I think it's about knowing which common security problems need attention, which standard procedures exist to solve them and what tools are available for that in the ecosystem you're using.
<FromGitter> <proyb6> in additional, RoboCop are a nice code checker for Ruby, we need one for Crystal
<FromGitter> <vladfaust> We have ameba
<FromGitter> <proyb6> Oh right, forgot about it and definitely need help on their Roadmap
<FromGitter> <mwean> I'm confused about this type warning I'm getting: โŽ โŽ `````` [https://gitter.im/crystal-lang/crystal?at=5bb516081c100a4f29274944]
<FromGitter> <mwean> it seems like the type should be clear from that
francisl has quit [Quit: francisl]
<FromGitter> <Sija> @vladfaust `Time | Nil` (or better `Time?`) is `Union(Time, Nil)`, not `Union(Time | Nil)`, just FYI
<FromGitter> <bew> @mwean The error also explains how the type inference work, and what works to auto-type an instance variable. So in this case you have to declare `@next_port : Int32` in the class (outside methods)
<FromGitter> <dscottboggs_gitlab> logically speaking wouldn't Unions flatten? so that *union of time and nil* and *union of time and time and nil* would be the same thing?
<FromGitter> <Sija> @vladfaust `Time | Nil` itself is an `Union` itself, no need for wrapping it in another `Union`
<FromGitter> <Sija> @dscottboggs_gitlab they do, but writing `Union(Time | Nil)` instead of `Time | Nil` is justโ€ฆ confusing?
<FromGitter> <dscottboggs_gitlab> I agree, but it wouldn't not work. ha
<FromGitter> <mwean> @bew ah, so the problem is the `+ 1`. I see it works if I remove that. That's pretty strange, but thanks!
<FromGitter> <bew> It's all explained in the error :)
<FromGitter> <bew> But yeah, the + 1 is a method call to `Int32#+` and the compiler does go through method calls
<FromGitter> <mwean> I guess you could say it's explained in the error, but I assumed that `arg` was just a placeholder and that a pure function and referential transparency would imply that `Int32 + Int32` could be reduced to `Int32`
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <fridgerator> This was on the front page of HN earlier : http://www.doxsey.net/blog/kubernetes--the-surprisingly-affordable-platform-for-personal-projects
<FromGitter> <fridgerator> The author uses crystal in the Dockerfiles
baweaver_away is now known as baweaver
francisl has joined #crystal-lang
<FromGitter> <bew> This is pretty cool!
<FromGitter> <girng> what is a Kubernete
francisl has quit [Quit: francisl]
<FromGitter> <fridgerator> Container orchestration software written by Google
akaiiro has joined #crystal-lang
<FromGitter> <Blacksmoke16> what docker swarm should be
<FromGitter> <girng> not even going to google that, im already lost
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> docker is great
<FromGitter> <fridgerator> Yep
<FromGitter> <fridgerator> I'm trying to use crystal_lib to generate bindings from a .h file. The .h file is located in another directoy and the `@[Include` is just the full path to the .h file
<FromGitter> <fridgerator> The .h file includes relative `#include` statements, but it seems crystal_lib doesn't follow these? I get fatal error file not found for those includes
<FromGitter> <fridgerator> Do I need to move all of the .h files into my `crystal_lib` dir or something?
<FromGitter> <vladfaust> Thanks, Sija, I didnโ€™t know that
<FromGitter> <vladfaust> Related to my issue in crystal, right?
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <vladfaust> However, https://github.com/crystal-lang/crystal/issues/6730 is still actual
Groogy1 has quit [Ping timeout: 246 seconds]
Groogy1 has joined #crystal-lang
<FromGitter> <vladfaust> How can I know if including `@type` is class or struct?
<FromGitter> <vladfaust> `@type.class.superclass` may not work as expected with inherited classes
<FromGitter> <vladfaust> `@type < Class` does the job
DTZUZO has joined #crystal-lang
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO_ has joined #crystal-lang
DTZUZO_ has quit [Read error: Connection reset by peer]
shmibs has quit [Quit: leaving =o]
DTZUZO_ has joined #crystal-lang
shmibs has joined #crystal-lang