RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
bjz has joined #crystal-lang
vikaton has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
mati_urunda has quit [Ping timeout: 265 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
matp has quit [Quit: Bye!]
matp has joined #crystal-lang
jhass has quit [Ping timeout: 260 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
DeBot has quit [Ping timeout: 260 seconds]
asterite has quit [Ping timeout: 250 seconds]
shawn42 has joined #crystal-lang
jhass has joined #crystal-lang
asterite has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
vikaton has joined #crystal-lang
akwiatkowski has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
mgarciaisaia has joined #crystal-lang
Philpax has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
A124 has quit [Remote host closed the connection]
A124 has joined #crystal-lang
<FromGitter> <KingPixil> hey guys!
<FromGitter> <KingPixil> I'm new to crystal!
<FromGitter> <cjgajard> hello :)
<FromGitter> <KingPixil> hi!
<FromGitter> <KingPixil> crystal is awesome, can't wait to dig in deeper :)
<FromGitter> <KingPixil> how can i add a route to a web app?
<FromGitter> <KingPixil> using `http`
<FromGitter> <cjgajard> there's no routing in `HTTP::Server` from stdlib, but you can use any of the routing shards (libraries) out there. Have you checked Kemal? (https://github.com/sdogruyol/kemal)
<FromGitter> <KingPixil> yeah, but I want to know what's under the hood
mgarciaisaia has quit [Ping timeout: 252 seconds]
<FromGitter> <KingPixil> how does it create a route?
<FromGitter> <cjgajard> it makes a tree of paths, each path is associated with a `Proc`, adds a `HTTP::Handler` to there server which searches the path in the tree and calls it if found any or returns 404... (kind of... :sweat_smile: )
mgarciaisaia has joined #crystal-lang
<FromGitter> <KingPixil> oh, thanks! i'm looking into it
mgarciaisaia has quit [Ping timeout: 246 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 260 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 240 seconds]
mgarciaisaia has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philpax has quit [Ping timeout: 260 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
mgarciaisaia has quit [Ping timeout: 248 seconds]
mgarciaisaia has joined #crystal-lang
soveran has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
soveran has quit [Remote host closed the connection]
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
Nik736 has joined #crystal-lang
bjz has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 268 seconds]
mgarciaisaia has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
pawnbox has joined #crystal-lang
mati_urunda has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 250 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 245 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 265 seconds]
mgarciaisaia has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
Yxhuvud has quit [Ping timeout: 250 seconds]
j2k has joined #crystal-lang
akwiatkowski has joined #crystal-lang
bjz_ has quit [Ping timeout: 258 seconds]
<FromGitter> <sdogruyol> is bountysource.com/ down?
pawnbox_ has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
Yxhuvud has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Nik736 has quit [Quit: Textual IRC Client: www.textualapp.com]
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Quit: Leaving.]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
_whitelogger has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Nik736 has joined #crystal-lang
pawnbox has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
shawn42 has quit [Quit: Connection closed for inactivity]
mgarciaisaia has joined #crystal-lang
<crystal-gh> [crystal] lbguilherme opened pull request #3582: [WIP] Windows (master...win) https://git.io/v1TNd
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<RX14> one day I'm going to set up a test jenkins for all the different targets we support
<RX14> can't be too hard...
<RX14> Hardest part would be OSX because I have 0 experience with it honestly
<Papierkorb> You need a OS X box (mac mini or so) if you want to make it legal, as you're not usually allowed to run their OS in a VM on a non macOS host machine. Maybe there's a license allowing for it though
<RX14> especially with Jenkins 2.0 and the new UI the setup could be quite nice
<RX14> Papierkorb, yeah...
<RX14> the jenkins slave might end up being on someone's dev laptop#
<Papierkorb> Maybe you could persuade manastech or so to hook up a mac mini into a serverrack ;)
<RX14> maybe so
<RX14> oh wow macs are expensive
<Papierkorb> They are, and don't even look at their specs
<RX14> thats almost laughable
<Papierkorb> Ah well, maybe one from ebay would do, or it could be crowd-funded. "Starting at 569€" ... wow
<RX14> hmm
<Papierkorb> The cheap mac mini only has 4GiB RAM .. and a 1.4GHz dual core cpu. Eh.
<RX14> i wonder if we could use scaleway VMs for the ARM tests
<RX14> i wish I had more free time to sort out stuff like this
<Papierkorb> > 8 GB LPDDR3 SDRAM mit 1600 MHz
<Papierkorb> I shouldn't have opened the apple shop
<RX14> i wonder how the stdlib wil look with if flag? everywhere for windows
<Papierkorb> Maybe stupid, but maybe have a compat layer written in Crystal, which is required if on windows, which then provides fopen() and friends. Dunno if this would make it better for much of the stdlib though.
<RX14> yeah thats what I think will eventually happen
<RX14> something like lib_c currently
<RX14> with the load path hacks
<Papierkorb> Still better than #ifdef hell I'm afraid
<RX14> and just being basically an OS abstraction
<RX14> Papierkorb, exactly
<RX14> it's already ifdef hell anywhere near the concurrency code
<BlaXpirit> why does ifdef have to be hell
<RX14> because every platform has different semantics, and once you support more than 3 you end up with hell everywhere platform specific
<RX14> and there's always a whole lot more thats platform specific than you expect
<Papierkorb> BlaXpirit: It's an indication of wanting an abstraction layer. There are cases where you need it, but I like a require hack more than cluttering everything with ifdef, which you can forget to do and suddenly your nice new method blows up anywhere else
<RX14> we essentially want a libc abstraction over windows
<Papierkorb> fiber.cr is a place where I fear ifdef is fine, and which for windows, will grow even more, thanks to MS doing the x64 ABI different to anyone else
<RX14> i wonder if we can get away with just creating a manual lib_c that's not actually a lib definition
<RX14> at that point you might as well use an existing posix windows wrapper
<RX14> and just link that statically
<RX14> which I would be all for
<Papierkorb> Same here, why reinvent the wheel
<RX14> i think using an existing posix wrapper should still be possible with msvc
<Papierkorb> As long the license of it allows it, some things can get really iffy. I still wonder how cygwin emulates fork().
<RX14> magic
<BlaXpirit> what i think is.. there should be large platform-specific chunks, maybe even files, not 100 ifdefs per file
<BlaXpirit> then it's not so scary
<BlaXpirit> putting Windows stuff through POSIX abstractions is no good
<BlaXpirit> but a general thin abstraction just to separate implementations is good in my opinion
<BlaXpirit> all languages go through this, it's not such a big deal
<RX14> BlaXpirit, yes thats what we were suggesting
<RX14> like lib_c is currently
<RX14> a folder for each target
<RX14> it's probably a good start though to reuse an existing wrapper
<Papierkorb> We can still make adjustments, code is there to be changed afterall
<Papierkorb> IMO it's more important to have a quick start and get people to use it than to have the perfect solution 3 years later
<crystal-gh> [crystal] MakeNowJust opened pull request #3583: .crystal directory is no longer created (master...fix/no-longer-crystal-dir) https://git.io/v1Tpr
<RX14> hmm
<Papierkorb> Is there a reason that IO::FileDescriptor does not have #ioctl ?
<Papierkorb> Was there a tool which converted C headers into a `lib`?
<Papierkorb> thanks
<RX14> ok
<RX14> specs pass with the new select
<RX14> not that I've added any
<Papierkorb> The FileDescriptor select stuff?
<RX14> yes
<Papierkorb> May contribute the tests then
<RX14> i added a resume token to each Fiber
<RX14> so that you can send a Void* through Fiber#resume
<RX14> then each select action is responsible for identifying it's own resume token
<Papierkorb> Could it be abused for that what I think you could?
<Papierkorb> Signaling a `gtfo` to a fiber?
<RX14> yup
<Papierkorb> Though I still think raising an exception is better for that, only running the `ensure`s sounds like more work for something exceptions do anyway
<RX14> but
<RX14> you can catch ex : Exception
<RX14> and retry
<RX14> we want un uncatchable exception
<Papierkorb> Do we?
<Papierkorb> Catching `Exception` uncarefully is broken code
<RX14> not really
<crystal-gh> [crystal] MakeNowJust opened pull request #3585: Clean up trailing newline in .gitignore of crystal init (master...fix/cleanup-gitignore) https://git.io/v1Tjl
<RX14> sometimes you want to run a user event handler
<RX14> but you wabnt to just log exceptions
<RX14> instead of crashing the whole thing
<Papierkorb> I don't see much wrong for that case to also catch StopError (or w/e) too in that use-case
<Papierkorb> (grammar at its finest, jeez)
<RX14> hmm
<Papierkorb> catching the root exception type is always an unusal, finicky thing. Retrying from that sounds like a general bad idea.
<Papierkorb> At least in all languages I've come across
<FromGitter> <sdogruyol> @Papierkorb have you seen this https://github.com/crystal-lang/crystal/pull/3582 ?
matp has quit [Remote host closed the connection]
<Papierkorb> Yes I have, thanks
<FromGitter> <sdogruyol> WDYT?
matp has joined #crystal-lang
<Papierkorb> `wdyt`?
<FromGitter> <sdogruyol> what do you think about it
<RX14> it's too early to tell how the worting will go
<RX14> porting*
<Papierkorb> Sounds like a good start and basically what we were talking about yesterday
<FromGitter> <sdogruyol> @RX14 yeah
<Papierkorb> But time will tell of course. I'm positive that if there's a developer proficient with windows around that it'll get quite stable in the long run
<RX14> i'm most interested to see how the winapi abstraction will be handled
<FromGitter> <sdogruyol> i thought you were going to open a PR soon @papierkorb :P
<FromGitter> <sdogruyol> does winapi has differences between 32 bit and 64 bit?
<Papierkorb> sdogruyol, I dropped that after I read in the "want windows" issue that @lbguilherme wanted to PR something this week-end
<Papierkorb> Most likely
<Papierkorb> MS also uses their own x64 ABI
<Papierkorb> Everyone but MS uses one, and MS uses their own
<Papierkorb> it's glorious
<FromGitter> <sdogruyol> then it's gonna be crap show :D
<RX14> damn, i'm going to have to use Select.select instead of #select because of the select keyword
ssvb has quit [Read error: Connection timed out]
pawnbox has quit [Remote host closed the connection]
<FromGitter> <spalladino> > **<RX14>** Hardest part would be OSX because I have 0 experience with it honestly ⏎ ⏎ ⏎ I know it's not Jenkins, and to be honest I haven't tried it, but have you checked if Circle's iOS builds on OSX machines can be used to compile something else than an XCode project? https://circleci.com/docs/ios-builds-on-os-x/ [https://gitter.im/crystal-lang/crystal?at=5839cbb073abd79c559ca000]
<RX14> yes but I want to run Jenkins on it
pawnbox has joined #crystal-lang
<RX14> we already have travis for x86 and osx
<FromGitter> <spalladino> Oh ok
<RX14> I want to build something custom which works for *all* architectures
<BlaXpirit> RX14, interestingly enough, I think Nim project had that initially but then switched to Travis
<RX14> jenkins?
<RX14> jenkins has improved a lot in the last year
<RX14> they released 2.0
<BlaXpirit> not jenkins, i think something custom
<RX14> added Jenkinsfile
<RX14> well how do they test like windows and stuyff
<BlaXpirit> seems like they don't..? lol
<RX14> yeah well i'm not OK with that
<BlaXpirit> sure
<RX14> if a platform doesn't have CI it's bound to break
pawnbox has quit [Remote host closed the connection]
<RX14> anything without a CI build is essentially unsupported
ssvb has joined #crystal-lang
<BlaXpirit> so i'm looking at the pull request for Windows support
<BlaXpirit> and umm it probably can't be bootstrapped
<BlaXpirit> just because compiler uses standard library..?
<RX14> well
<RX14> once he ports the stdlib obviously it can be bootstrapped
vikaton has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #3587: Correct example in TCPServer (master...fix/doc/tcp-server-example) https://git.io/v1kfL
pawnbox has joined #crystal-lang
shawn42 has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kUn
<crystal-gh> crystal/master 72cd210 Ary Borenszweig: crystal init: fixed spec related to version
<crystal-gh> [crystal] asterite opened pull request #3588: Add pretty print (master...feature/pretty_print) https://git.io/v1kTT
<crystal-gh> [crystal] asterite closed pull request #3583: .crystal directory is no longer created (master...fix/no-longer-crystal-dir) https://git.io/v1Tpr
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kTm
<crystal-gh> crystal/master 9446b22 TSUYUSATO Kitsune: Clean up trailing newline if not lib [ci skip]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kTO
<crystal-gh> crystal/master 0932cf0 TSUYUSATO Kitsune: Correct example to write client instead of server [ci skip]
<travis-ci> crystal-lang/crystal#72cd210 (master - crystal init: fixed spec related to version): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179087169
<crystal-gh> [crystal] azah opened pull request #3589: Add tables support for Markdown (master...add_markdown_tables_support) https://git.io/v1kTN
<FromGitter> <sdogruyol> dropping libc is the ultimate task :D
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
<7IZAAKI41> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kko
<7IZAAKI41> crystal/master 2a273e6 Sijawusz Pur Rahnama: Uncomment TODO spec
<14WAAMNGG> [crystal] asterite closed pull request #3575: Uncomment atomic_spec.cr (master...atomic-spec-todo) https://git.io/v1fNT
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kkK
<crystal-gh> crystal/master afe8bb6 Ary Borenszweig: Allow applying a CallConvention attribute to a lib declaration. Fixes #3590
Fichtenstein has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 260 seconds]
mgarciaisaia has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
<travis-ci> crystal-lang/crystal#2a273e6 (master - Uncomment TODO spec): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179095017
<travis-ci> crystal-lang/crystal#afe8bb6 (master - Allow applying a CallConvention attribute to a lib declaration. Fixes #3590): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179095052
mgarciaisaia has quit [Ping timeout: 248 seconds]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] lbguilherme opened pull request #3591: Remove unneeded escapes from inline assembly (master...patch-8) https://git.io/v1km3
mussela has joined #crystal-lang
<mussela> hey!
<FromGitter> <sdogruyol> hey
<mussela> does anyone know if there's a shorthand to declare lots of instance variables of the same type on one line?
<mussela> like @a, @b, @c: Int32 ?
<BlaXpirit> if they have getters or setters then easily
<mussela> how easily? :D
<crystal-gh> [crystal] splattael opened pull request #3593: Remove `libs` from search path (master...remove-libs) https://git.io/v1kYK
<BlaXpirit> actually, no, that doesnt help. sorry. getter a : Int32, b : Int32
<mussela> ah ok, thanks anyway
<BlaXpirit> there is no such shortcut, pretty sure
<BlaXpirit> i mean, if you really have a ton of names, then you can do {% for name in %w[a b c] %} @{{name.id}} : Int32 {% end %}
<FromGitter> <sdogruyol> yeah that macro is pretty ok
<mussela> wow, that's pretty cool
<mussela> thanks
<FromGitter> <sdogruyol> @mussela be sure to check out macros https://crystal-lang.org/docs/syntax_and_semantics/macros.html
<mussela> yeah, been meaning to get into them more, but want to master the basics first
<mussela> the {{name.id}} thing is weird
<mussela> why id? (well, sure there's a good reason but its not intuitive)
<BlaXpirit> mussela, `name` would be a string, and upon .inspect it would paste `"a"` into the code
<BlaXpirit> we dont want @"a" : Int32
<BlaXpirit> so we turn it into a special type for identifiers that has .inspect as itself
<BlaXpirit> somthing like that
<mussela> I see, but this must be a common usecase - are we stuck with `id` with the most common case? :|
<mussela> surely there's a better name
<BlaXpirit> actually i'm quite sure there isnt. sweet and short
<mussela> I'd go for `text`
<mussela> short is not always more readable or intuitive, but I guess that's a matter of taste :D
<BlaXpirit> mussela, hm also maybe you want a static array of, say, 8 numbers
<mussela> the vars' actual names are {% for name in %w(id x y width height) %}
<BlaXpirit> i'd say not worth doing anything weird about these. just write out the identifiers
<mussela> I could do the array but it feels weird to work by index
<BlaXpirit> no no this is not the usecase
<mussela> then I misunderstood
<BlaXpirit> also you may be interested in `def initialize(@id : Int32, @x : Int32, @y : Int32, @width : Int32, @height : Int32)`
<Papierkorb> mussela: if you're cluttering your code with macros I don't think that .id is the main issue
<mussela> the initializer takes XML and populates the vars after parsing it
<mussela> I'm just a lazy typer :D
<BlaXpirit> then there is a common pattern like: def self.new(xml); self.new(xml["id"].to_i32, etc etc); end
<mussela> BlaXpirit: this is what I ended up with https://gist.github.com/sardaukar/6bda70f2a5dc55aeb66997118f819dfa
<mussela> the macro is really not needed :P
<mussela> this is part of a TMX (Tiled editor) parser
<mussela> also
<mussela> alias TMXPropertiesMap = Hash(String, TMXPropertyValue) alias TMXPropertyValue = Int32 | Float64
<mussela> btw, is `type` a reserved keyword? my text editor is freaking about it
<BlaXpirit> it is reserved but acts only inside `lib`
<mussela> I see - better change it, anyway
<mussela> btw, I'm using your EXCELLENT SFML bindings!
<mussela> my game would not exist without your work, thanks!
<BlaXpirit> :> oh there's a game? would be nice to see
mgarciaisaia has quit [Ping timeout: 248 seconds]
<mussela> BlaXpirit: right now, this is all there is to it http://i.imgur.com/ivCeCcg.png
<mussela> there's collision on the tiles, and Link can walk around (the red boxes are to help with seeing where his feet are)
<BlaXpirit> cool
bjz has joined #crystal-lang
<mussela> the idea is to create an engine and have quests be scriptable
<mussela> but Crystal's lack of runtime dispatch might kill that :D for now, I'm doing a custom quest
<BlaXpirit> um not sure what you mean. runtime dispatch is present
<mussela> I mean being able to eval code at runtime
<BlaXpirit> oh now we're talking
<mussela> if all the quest info is on a file, it's hard to do things like "when I push a switch, open the door"
<mussela> or maybe not, haven't got to it yet :D
mgarciaisaia has joined #crystal-lang
<mussela> like, this is my Entities "dictionary" as of now https://gist.github.com/sardaukar/4d8e54ff9eb8ee308e38394fa96d1d9b
<mussela> I can see some issues doing this at runtime from a file
mati_urunda has quit [Ping timeout: 244 seconds]
Nik736 has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has quit [Remote host closed the connection]
mgarciaisaia has quit [Ping timeout: 250 seconds]
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
Ven has joined #crystal-lang
mati_urunda has joined #crystal-lang
mati_urunda has quit [Ping timeout: 240 seconds]
mgarciaisaia has quit [Ping timeout: 260 seconds]
<RX14> oh wow
<RX14> it works
<RX14> this is magical
<RX14> first try
<RX14> hmm