ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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
DTZUZU has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 248 seconds]
DTZUZO has joined #crystal-lang
DTZUZU has joined #crystal-lang
dtcristo has joined #crystal-lang
_asqrd has joined #crystal-lang
_asqrd has left #crystal-lang ["Leaving"]
snsei has joined #crystal-lang
chamar has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <Fanna1119> why can i not do ⏎ ⏎ ```x = gets.not_nil!.to_i ⏎ ``` [https://gitter.im/crystal-lang/crystal?at=59ab9832bc46472974eea338]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <bararchy> Cool benchmarks https://github.com/kostya/benchmarks/blob/master/README.md
<FromGitter> <bararchy> In mandel it seems we got better results then Rust
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
A124 has quit [Read error: No route to host]
A124 has joined #crystal-lang
<FromGitter> <kyku> @Fanna1119 : how about ⏎ ⏎ ```?``` [https://gitter.im/crystal-lang/crystal?at=59abbd68614889d475b64b11]
<FromGitter> <solisoft> @Porcupine96 you should consider ArangoDB also ... AQL is very useful
snsei_ has quit [Remote host closed the connection]
Tuxified has joined #crystal-lang
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has quit [Ping timeout: 240 seconds]
<oprypin> kyku, omg so that's the answer to everything
<FromGitter> <jose-rodrigues> Hello guys. I'm trying to use iconv with crystal but il looks like a little low level is there any other way to convert encodings in crystal?
<oprypin> time to put `gets` in the trash
<Papierkorb> "kyku"?
<Papierkorb> Oh it's a nick
<oprypin> jose-rodrigues, it's a long story. try searchign "encoding" in https://devdocs.io/crystal/
<FromGitter> <jose-rodrigues> @oprypin I've look but found nothing to convert. I tryed to use scrub but I get a lot of weird characters
<oprypin> jose-rodrigues, ok please explain what exactly you're trying to achieve. I haven't seen such a description
bmcginty has quit [Ping timeout: 248 seconds]
bmcginty has joined #crystal-lang
<FromGitter> <jose-rodrigues> I've a string in windows-1252 and want to convert it to utf-8
<oprypin> jose-rodrigues, ah perfect, the example i was brewing up is almost exactly matching https://carc.in/#/r/2nn5
<FromGitter> <kyku> @oprypin , might be, but be sure to catch it....
<oprypin> i think a crash is appropriate tbh
<oprypin> it's almost always the behavior i want, clearer than .not_nil! too
<FromGitter> <sdogruyol> Morning everyone
<oprypin> python's IO avoids nils in all cases i think. if you expect a string but get EOF, that's the definition of an exceptional case. why return nil, especially if it's at such a huge price of confusion for beginners
<oprypin> confusion about `gets` is actually a very high percentage of questions here
<oprypin> i was gonna suggest not returning `nil` from it but with `read_line` already doing that it's a harder case
ShalokShalom_ has joined #crystal-lang
<FromGitter> <jose-rodrigues> @oprypin Thank I've managed to do that this way: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59abd8edbc46472974ef749f]
A124 has quit [Quit: '']
<oprypin> nonononono
<oprypin> nono no no no no
<FromGitter> <sdogruyol> what's going on
<oprypin> just storing arbitrary bytes in a string, that always triggers me
ShalokShalom has quit [Ping timeout: 252 seconds]
<oprypin> so you're taking bytes, illegally storing them in a string only to immediately get the bytes back, then converting it to a text string properly
<oprypin> and the 2nd line you're converting text to bytes and back to the same exact text, so it's a no-op
<FromGitter> <sdogruyol> not everyone is so knowledgable about strings
<FromGitter> <sdogruyol> and bytes for sure
<oprypin> it's not even about knowledge, it's blind assumptions of bad practices from ruby
<FromGitter> <sdogruyol> Ruby makes it so easy to do so ..
<oprypin> jose-rodrigues, the thing to understand here is that `String` in Crystal is strictly for text. it always must have valid text in it (that internally happens to be represented as UTF-8)
<oprypin> what went wrong in the first place: texts[0] appears to be bytes illegally stored in a string. they should have been stored in a Slice(UInt8) aka Bytes
<oprypin> then all you need is `profile.description = String.new(actually_bytes, encoding: "windows-1252").strip`
<FromGitter> <bew> @jose-rodrigues what is ˋtextsˋ type?
<oprypin> > texts[0] appears to be bytes illegally stored in a string
<oprypin> could it be an XML node
<FromGitter> <bew> Oh that would explain the inner_text thing
<FromGitter> <jose-rodrigues> @bew text is an object from `myhtml` library
<oprypin> jose-rodrigues, that's the thing, instead of letting the parser produce illegal strings and dealing with the mess, you should just read the input document in that encoding in the first place
<oprypin> https://devdocs.io/crystal/api/0.23.0/xml#parse%28io%3AIO%2Coptions%3AParserOptions%3DParserOptions.default%29%3ANode-class-method
<FromGitter> <jose-rodrigues> @oprypin Ho thanks for the tip. It seems way more clean
<oprypin> well yeah but this is xml, need to find the equivalent for that html5 lib
<oprypin> but it has no docs page..
<oprypin> jose-rodrigues, honestly no idea, doesnt look like a good library to me. you can pass a correctly decoded string to the parser maybe
<oprypin> the parser lib does have its own facilities to detect encoding but maybe it's missing something
<oprypin> https://devdocs.io/crystal/api/0.23.0/file#read%28filename%2Cencoding%3Dnil%2Cinvalid%3Dnil%29%3AString-class-method
<oprypin> don't know where you're getting the bytes from but generally it looks like this 1) https://devdocs.io/crystal/api/0.23.0/io#set_encoding%28encoding%3AString%2Cinvalid%3ASymbol%3F%3Dnil%29-instance-method 2) https://devdocs.io/crystal/api/0.23.0/io#gets_to_end%3AString-instance-method
<FromGitter> <jose-rodrigues> I'm getting them with http::client so i thing in can play woth the ios
<oprypin> > If a response has a Content-Type header with a charset, that charset is set as the encoding of the returned IO (or used for creating a String for the body). Invalid bytes in the given encoding are silently ignored when reading text content.
<oprypin> it's too bad that you can't detect when it failed to get the info from content-type
<oprypin> so will have to hardcode `response.body_io.set_encoding("cp1252")`
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <bararchy> I want to create bindings for TensorFlow for Crystal, this project exists: https://github.com/fazibear/tensorflow.cr , but looking at the code & last time the owner has added code I feel like I should spin a new one
Groogy has joined #crystal-lang
<Groogy> Morning!
<FromGitter> <bararchy> Hi Groogy, how goes your day m8 ?
<Groogy> just woke up, no coffee in bloodstream yet
<Groogy> ;D
<Groogy> you then?
<FromGitter> <bararchy> Big mistake XD
<FromGitter> <bararchy> no coffie in the Praradox office ?
<FromGitter> <bararchy> hahah
<Groogy> no I'm at home, it's Sunday
<FromGitter> <sdogruyol> it's sunday lol
<FromGitter> <sdogruyol> hahaha
<Groogy> no but I need to go and buy milk, which means I need to put on pants
<Groogy> First world problems
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> aint delivery service?
<FromGitter> <bararchy> Oh, the places where Sunday is day off
<FromGitter> <bararchy> haha
<FromGitter> <bararchy> I'll never get used to it
<FromGitter> <sdogruyol> @bararchy do you officially work on Sunday?
<FromGitter> <bararchy> ofc
<Groogy> isn't sabbath on sundays?
<FromGitter> <sdogruyol> what
<FromGitter> <bararchy> Exactly
<FromGitter> <sdogruyol> that's weird
<FromGitter> <bararchy> Sabbath is day off
<FromGitter> <sdogruyol> saturday and sunday is off
<FromGitter> <bararchy> as in Firday
<Groogy> oh lol
<FromGitter> <bararchy> Friday & saturday
<FromGitter> <sdogruyol> a bit different :D
<Groogy> do you guys also have like USA that the week starts on sunday?
<FromGitter> <bararchy> Yeha
<FromGitter> <sdogruyol> oh
<FromGitter> <sdogruyol> makes sense
<FromGitter> <bararchy> Sunday even called "First Day" in Hebrew
<FromGitter> <bararchy> יום ראשון
<FromGitter> <bararchy> actually translated to "the first day"
<FromGitter> <sdogruyol> :D
<FromGitter> <bararchy> lol
<Groogy> lol
<FromGitter> <sdogruyol> Monday is literally "After Sunday" in Turkish
<FromGitter> <bararchy> yeha, not much thought putten into it hahah
<FromGitter> <bararchy> hahah
<FromGitter> <bararchy> nice
<Groogy> Saturday(Lördag) for us means "The day you clean yourself"
<Groogy> i.e take a shower
<FromGitter> <sdogruyol> haha
<FromGitter> <bararchy> Oo
<FromGitter> <sdogruyol> that's weird
<FromGitter> <bararchy> LOL really ??
<FromGitter> <sdogruyol> Cleaning day
<Groogy> Vikings were really clean compared to other groups during that age ;D
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> respect the beard
<FromGitter> <sdogruyol> 👍
<Groogy> Yeah the beard doesn't become so nice and lish without hard effort put in
<Groogy> lush*
<FromGitter> <bararchy> XD
<FromGitter> <sdogruyol> i once had some beard
<FromGitter> <sdogruyol> it's hard to keep it clean
ShalokShalom_ is now known as ShalokShalom
<Groogy> either way I am getting quite done in basic for graphics to just "work", wondering if I should implement UI or try and port someone else UI in somehow
<Groogy> didn't find much in shards that seemed interesting :/
<FromGitter> <bararchy> Groogy , does you graphic engine is Crystal native ?
<Groogy> yeah
<FromGitter> <bararchy> Maybe I'll try doing a simple UI to my port scanner ? Tried in the QT binding but it was too much code for such a small task
<FromGitter> <bararchy> Task
<Groogy> though you don't need to use the application structure I am using here, it will work as long as you create the graphics context manually
<FromGitter> <bew> Groogy Just looking at the code, your InputHandler doesn't store the state it is initialized with, is it intentional?
<Groogy> what do you mean?
<FromGitter> <bararchy> Groogy Why is the shader on a different dir ?
<Groogy> you mean in dist/?
<FromGitter> <bararchy> y
<Groogy> dist stands for distribute, just what gets shipped
<Groogy> also where I generate the executable
<FromGitter> <bararchy> Is it an external part of the software ?
<FromGitter> <bararchy> (first time UI\Graphic )
<Groogy> It's where the resources, data and the executable ends up
<Groogy> what gets shipped to the customer
<FromGitter> <bew> In your InputHandler, your constructor take a state, but you don't use it
<Groogy> ah yeah because I am just testing stuff
<Groogy> I used it before to quit the application whenever you pressed a button
<FromGitter> <bew> Aaaaah ok x)
<FromGitter> <krypton97> It's
<FromGitter> <krypton97> 37°C here
<FromGitter> <krypton97> Has to be a pain to work these day
<Groogy> Seeing that while living in Sweden as we are slipping int othe cold dark days that is of winter... >_>
<FromGitter> <sdogruyol> cold is worst
<FromGitter> <krypton97> It's better there, here in the summer is very hot and winter very cold. Deal with it I guess
<Yxhuvud> how cold is very cold for you?
<FromGitter> <sdogruyol> anything below 15 degrees is cold for me
<Yxhuvud> I hope you mean *negative* 15 degrees ;)
<FromGitter> <bararchy> @sdogruyol Look at those people who don't know what real heat is
<FromGitter> <sdogruyol> :D
<FromGitter> <bararchy> IL, dead sea, 50C in shade
<FromGitter> <sdogruyol> Ugh, I don't want to remember those days in my hometown
<FromGitter> <sdogruyol> 40-50 degrees :/
<FromGitter> <bararchy> yeha
<Groogy> You merely adopted the Cold, me and Yxhuvud were born in it, molded by it. We did not know the feeling of heat until we were adults!
<Groogy> also finally my first sip of coffee
<FromGitter> <bararchy> haha GroogyBane
<Groogy> I've had a bbq in the blizzard mind you
<FromGitter> <faustinoaq> If you know some of spanish you can listen El Maratón Linuxero live now https://www.youtube.com/maratonlinuxero/live
<Groogy> what's that?
<FromGitter> <faustinoaq> A big Linux postcast in Spanish
<Groogy> huh seems like live streamed videos on Youtube don't like my opera :(
DTZUZO has joined #crystal-lang
<FromGitter> <bararchy> My twitter is 50% Crystal, 40% Neural Networks, 10% @sdogruyol
<FromGitter> <bararchy> lol
<FromGitter> <faustinoaq> My second tweet was about crystal lol https://twitter.com/totakaro/status/751346963656937473
<Groogy> my twitter is mainly games, and more games
<FromGitter> <bararchy> I'm following GamingOnLinux
<FromGitter> <bararchy> Just downloaded Xcom2 yesterday
<FromGitter> <bararchy> gonna tackle DOW3 next month
<Groogy> should play my game ck2 ^^
<Groogy> if you like strategy
<FromGitter> <bararchy> Couldn't get my head aruond it, I like RTS, those kind of games are a little bit too havy for me
<FromGitter> <bararchy> But I heard it's awsome
<FromGitter> <bararchy> I bought it a few months ago
<Groogy> there's bunch of youtubers that does an excellent job in teaching it
<FromGitter> <bararchy> But I played Tyranny :)
<crystal-gh> [crystal] miketheman opened pull request #4919: Remove unused filename parameter from Formatter (master...miketheman/remove-filename-from-formatter) https://git.io/v505B
dom96 has quit [Changing host]
dom96 has joined #crystal-lang
<Groogy> yeah but I didn't work on that :P
<FromGitter> <gabrielrios> ck2 is awesome
<Groogy> :D
ShalokShalom has quit [Read error: No route to host]
ShalokShalom has joined #crystal-lang
<FromGitter> <bararchy> Groogy do you currently work on the expenstions like Jade Dragon , etc.. ?
<Groogy> no right now I am working on EU4 and its expansions
<FromGitter> <bararchy> Oh cool :)
<FromGitter> <bararchy> The things you see in shards.xyz https://github.com/njkli/gpd-fan
<Groogy> hah
chamar has quit [Read error: Connection reset by peer]
<FromGitter> <bararchy> Groogy: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59ac0d978f4427b462ca2a13]
<FromGitter> <bararchy> when trying to compile ego
<Groogy> yeah I've done a pull request to the guy who made the GLFW3 bindings
<Groogy> he misspelled it
<Groogy> but don't think he is active :/
<Groogy> I'll probably just tell the shard to point at my fork instead later
<FromGitter> <bararchy> Why do you need glfw ?
<Groogy> it handles the OS stuff like creating windows, getting input etc
<Groogy> so I don't have to implement WinAPI, etc. etc. myself
<FromGitter> <bararchy> Dosn't boleite support that ?
<Groogy> yeah Boleite is what needs GLFW?
<FromGitter> <bararchy> Oh
<FromGitter> <bararchy> lol
<FromGitter> <bararchy> I see
<FromGitter> <bararchy> got it
<FromGitter> <bararchy> Maybe change it to work with the QT5 back end instead ? seems more active
<FromGitter> <bararchy> (if it makes sense)
<Groogy> it's possible, architecture is done so I can have several backends implemented
<Groogy> and just pick what makes sense
<FromGitter> <bararchy> That could be cool
<Groogy> just using GLFW right now since it's simple and I knew how it worked already
<Groogy> so if something went wrong I usually could guess what went wrong
<FromGitter> <bararchy> Groogy ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59ac0fdb162adb6d2e624a06]
<FromGitter> <bararchy> Is it looking for the shader in a specific dir ?
<FromGitter> <bararchy> on same dir maybe ?
<Groogy> the executable needs to be in the dist folder when you run it
<Groogy> couldn't find a way to tell crystal "build and run this but with this work directory"
<Groogy> I have a script in VS Code that does it for me
<FromGitter> <bararchy> Yap, got it to work, horrible red screen and badly drawn smily face :)
<Groogy> exact ;D
<Groogy> try to add this to the render method
<Groogy> @sprite.rotate delta.to_f * 10
<Groogy> should make it rotate over time
<FromGitter> <sdogruyol> haha thanks @bararchy :D
<FromGitter> <bararchy> ? What for
<FromGitter> <bararchy> Groogy sent you a PR, making your life easy haha
<FromGitter> <kyku> @oprypin : are you still here?
<Groogy> oh have you also tried to compile it?
<Groogy> but yeah to make my workflow make sense, in VS Code I have two batch scripts, one in Boleite that copies over the files so I don't need to commit them all the time
<Groogy> and then one in Ego that copies the generated executable to where I want to run it
<Groogy> bash scripts*
<FromGitter> <bararchy> We can just shove anything intop the Makefile
<FromGitter> <bararchy> soa single `make` command will do it all
<FromGitter> <bararchy> I love make files
<Groogy> I usually use Cmake yeah
<Groogy> I should redo this to be a cmake script instead
<Papierkorb> CMake is scary. Until you try other solutions, and suddenly, it's not that scary anymore ;)
<FromGitter> <bararchy> Hi Papierkorb :)
<Papierkorb> Yo
<FromGitter> <kyku> Shouldn't the IO.read_line return String instead of String|Nil : ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59ac130dbc46472974f03d10]
<Papierkorb> I moved, so wasn't near a computer the last days
<FromGitter> <kyku> Hi
<FromGitter> <bararchy> Nope, as it might not succed in reading
<FromGitter> <bararchy> then it will return nil
<Groogy> Papierkorb also it's what I've always used so ¯\(°_o)/¯
<Groogy> easier to use the devil you already know
<FromGitter> <kyku> @bararchy : it will throw if it fails to read...
<Papierkorb> Absolutely, why change what works just fine
<FromGitter> <bararchy> Hm.... true
<FromGitter> <bararchy> my bad
<FromGitter> <bararchy> Yeha, it should be String then
<Groogy> isn't nil if it doesn't read anything?
<FromGitter> <bararchy> it seems it will raise then
<FromGitter> <bararchy> because if gets fail, it's `raise EOFError.new`
<Groogy> oh right
<FromGitter> <bararchy> Got me too hahah
<Groogy> so might just be that in the source it doesn't ensure String type when returning?
<FromGitter> <bararchy> so the right return type should be String and not String?
<Groogy> yeah looking at the source
<Groogy> oh they specifically define the String?
<FromGitter> <kyku> Funny thing is that the compiler does not require to use not_nil! on read_line.to_i as it was smarter than what the function "declaration" says
<Groogy> so guessing just copy paste error
<FromGitter> <kyku> I will try filling a bug report for that...
<FromGitter> <bararchy> @kyku You can open an issue, and a PR is like 2 sec
<FromGitter> <bararchy> btw, what is the return type of gets ?
<FromGitter> <kyku> String?
<FromGitter> <bararchy> Hm...
<Groogy> yeah but the || raise would remove that I think
<Groogy> the ?
<FromGitter> <bararchy> What's the code in `gets` ?
<FromGitter> <kyku> one sec
<Groogy> it's right above that method
<FromGitter> <bararchy> ```return buffer.empty? ? nil : buffer.to_s```
<FromGitter> <bararchy> So gets can return a nil
<FromGitter> <bararchy> so there the `String?` makes sense
<FromGitter> <bararchy> in read_line it does not make sense
<FromGitter> <kyku> of course it can... but the point of read_line is to throw in situations where gets returns nil (end of file)
<FromGitter> <bararchy> but wouldn't the better way to handle this is return nil or String , so that you can handle this better then Exceptions ?
<FromGitter> <bararchy> Exceptions are pricy
<Papierkorb> So sharing a short fun fact: Recently, bindgen learned how to "transfer" default argument values over - Including string literals now. after that I was baffled that now QFileDialog::getFileOpenName() wasn't wrapped anymore, Crystal complained (rightfully) that `Qt::FileDialog.get_file_open_name` doesn't exists ("did you mean Qt::FileDialog.get_file_open_url"). Upon invastigation, turns out that the now-missing C++ function uses a `QString*
<Papierkorb> `, as in, a QString *pointer*. I added rules before that that it should ignore methods if the wanted pass-type (Which is by-value for `String`) doesn't match the C++ type (In this case, by-pointer). So .. in any case, I'll have to figure out a way of checking (?) or specifying the direction of a pointer-argument >_>;
<FromGitter> <kyku> @bararchy : if you want such behaviour, you can use "gets" and handle the nil case.
<Papierkorb> Mh what about a `Object#not_nil!(message)`? If it's nil, it raises the message. Bonus points if it lets me define the exception class as well.
<Papierkorb> Would make not_nil! a bit more end-user oriented. Now if *that* is a good thing is another question
<FromGitter> <bararchy> If it can recive an Exception.new("my message") It could be cool :)
<Papierkorb> Think that'd be too pricy by itself, as in the likely case of it not being nil you'd allocate an object for nothing
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<Groogy> hmm so I've hada thing I've needed to tackle all the time in Boleite
<Groogy> graphics cards prefer 32bit floating points
<Groogy> but default for Crystal is 64bit
<Groogy> for now I have Vector, matrices etc as generics so there are Matrix44f32, Matrix44f64 and then Matrix44f (the default)
<Groogy> but question is what should that default be?
<Papierkorb> Is a "default" type of matrix necessary?
<Papierkorb> And, does it make sense to use a full double for graphics?
<Groogy> well it's just a shorthand for one of the other because defining type every time is kind of annoying
<Groogy> it doesn't but matrix and vector are just linear algebra, not inherently in themselves part of graphics
<Groogy> right now I have so interacting with a sprite will use a Float64 but when it uploads the data to the graphics card it is 32bit
<Groogy> just so you don't have to do sprite.rotate 25f32 but simply 25.0 works
<Groogy> I don't like it being not coherent though
<Papierkorb> I'd define the type as `Float` (if defining any type) in the argument, and then `.to_f32` if required. One might argue "oh noes now it's implicitly casted, like in C!111" but honestly, writing the `f32` suffix isn't fun either.
<Papierkorb> But that's not the kicker to me.
<Papierkorb> The important thing is, will it be important in the future?
<Groogy> no I am just worried about accidentally uploading doubles
<Groogy> and such offset the data and suddenly we are not reading the data as we defined it
<Groogy> since you can just give the graphics card any kind of data but you have to tell it how you are supposed to read it
<Papierkorb> What do 3d model file types use?
<Groogy> 32bit floats definetly
<Groogy> you can be more fancy and use 64 bits
<Groogy> you can also do some fancy stuff with 16bit floating point textures
<Groogy> think CryEngine uses 16bit floating point textures
<Papierkorb> Then that'd be what I use honestly, with ("implicit") casting through #to_f32 so the user, if required at all, doesn't have to write the suffix.
<Groogy> hmm actually I might have done what you say by mistake
<Papierkorb> I mean, have a stern note in your documentation.
<Groogy> ah yeah I just have before creating the transformation matrix I convert the types
<Groogy> though no idea what would happen if @rot here is float 32
<Groogy> PI / 180.0 is Float64
<Papierkorb> @rot is Float64
<Papierkorb> As defined in line 7
<Groogy> true but let's say the type is not defined
<Groogy> and someone assigns a Float32
<Groogy> how does the math work out there or is it a compile error?
<Papierkorb> It does compile, and gives you a Float32
<Groogy> ah cool
<Groogy> hmm so if I am just super strict in the actual interfaces that work with OpenGL it might work out fine?
<Papierkorb> Probably
chamar has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #4921: Changed IO.read_line to return String rather than String? (master...fix-io-read_line-return-type) https://git.io/v50xe
_4d47 has joined #crystal-lang
<_4d47> hi guys, how do you write ( /[[:alpha:]]/ === a && a.upcase == a ) for a case expression ?
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
chamar has quit [Quit: Konversation terminated!]
<RX14> so you want to check if a is a capital unicode alphanumeric?
<crystal-gh> [crystal] akzhan opened pull request #4922: Fixes to bigint 32bit (master...fixes-to-bigint-32bit) https://git.io/v50pM
<FromGitter> <picatz> Interestingly, I can't get a case statement to work with that either ... but I can get a simple if to work.
<FromGitter> <picatz> I'm not sure why that'd be *the case* ( pun intended, but also still confused ).
<FromGitter> <picatz> I think regardless of what they're trying to achieve with that --- that should be, like, a thing they should be able to do, right?
<RX14> @picatz because one checks equality and one evaluetes a condition?
<_4d47> check that it has a letter and is all upcase
<RX14> if you put an expression as a case when
<RX14> it's going to return true or false
<RX14> which usually isn't === to whatever the case var is
<RX14> _4d47, so it's a string
<RX14> you want it to have at least 1 letter
<RX14> and all the letters to be uppercase?
<_4d47> yes
<RX14> str.each_char.any(&.letter?) && str.upcase == str
<RX14> regex is done with =~ for future reference
<RX14> but you shouldn't use it here
<FromGitter> <picatz> I guess I understand it a little better now. 👍
<_4d47> thanks RX14
<_4d47> what you mean =~ for future reference ? is it better to use =~ than === ?
<RX14> == is for testing equality
<RX14> you should never use ===
<RX14> =~ is for testing strings with regexes
<RX14> =~ takes a string on one side and a regex on the other and returns true if they match
<RX14> == is just normal defined equality
<RX14> === is special equality used for case statements by the compiler
<RX14> you shouldn't use it by hand
<_4d47> all clear
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
<_4d47> is it considered bad practice to reopen classes like String or Int to add utility methods ?
<Papierkorb> In a library? Yes, that's bad style.
snsei has joined #crystal-lang
<Papierkorb> In an application? Don't abuse it, but it's acceptable to *add* features (but not to modify)
<_4d47> Papierkorb 👍
<FromGitter> <krypton97> crystal seems to be the best :)
<FromGitter> <krypton97> that's a pretty big diff comparing to ruby
<txdv> where are the benchmark resuklts?
<FromGitter> <drujensen> they didn’t disable the static file handler in Kemal
<FromGitter> <krypton97> HERE
<FromGitter> <krypton97> click it
<FromGitter> <krypton97> could this really affect the performance?
<FromGitter> <drujensen> I think accessing the file system on every request to see if the file exists would cause a performance hit
<FromGitter> <krypton97> there's no public dir
<FromGitter> <drujensen> ```Kemal.config do |cfg| ⏎ cfg.serve_static = false ⏎ cfg.logging = false ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=59ac30d666c1c7c4770efc72]
<FromGitter> <drujensen> this will disable logging and the static file handler
<FromGitter> <krypton97> Yep, I'm talking to that guy right now, hoping to submit amber as well
<FromGitter> <drujensen> 👍
<FromGitter> <krypton97> After 3 weeks, I finally got in contact with it
<FromGitter> <krypton97> him*
<FromGitter> <drujensen> for Amber, you can remove the pipe for static file handler
<txdv> file IO is synchronous in crystal
<txdv> its blocking
<FromGitter> <drujensen> also if they have multiple cores, you will want to use the port reuse
snsei has quit [Remote host closed the connection]
<FromGitter> <drujensen> and launch multiple instances
<FromGitter> <drujensen> since we don’t have parallelism (yet)
<oprypin> txdv, file IO is asynchronous in crystal but control flow happens as if it was synchronous
<oprypin> txdv, what was the comment about, anyway?
<txdv> <drujensen> I think accessing the file system on every request to see if the file exists would cause a performance hit
<FromGitter> <krypton97> I've talked to him, seems that I need to wait for tomorrow's update oO
<txdv> oprypin: i don't think so, file io is blocking on linux at least
<oprypin> no
<txdv> if you want non blocking file io, you have to spin up threads and do th requests there
<oprypin> you cant even do that
<oprypin> txdv, how do you deduce that file IO is blocking??
<oprypin> and how do you define blocking, anyway
rohitpaulk has quit [Ping timeout: 260 seconds]
<txdv> i looked at the code?
<oprypin> probably looked at it wrong, i guess
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<txdv> also one of the devs told me
<txdv> unless they changed something
<oprypin> well it's possible, if it wasn't considered a priority, because it's supposed to be "instantaneous" anywawy
<txdv> this is what makes it look synchronous, but it really just switches the green thread to one which is ready to run
<oprypin> uh sure
<oprypin> but that's not blocking then
<txdv> this is the socket code
<txdv> which is not blocking
<txdv> now take a look at code for files
<oprypin> yep, I can agree with you
snsei has quit [Remote host closed the connection]
<oprypin> sorry
<txdv> so yeah, they are going to address this, but linux just doesn't provide any *usable* primitives for async file io
<txdv> libuv uses a threadpool to deligate run reads/writes for files
<txdv> windows has async file read/write but not open/close
<txdv> o yeah, reading from /dev/urandom blocks for a long time
<RX14> oprypin, even if you use O_NONBLOCK, for filedescriptors associated with files, instead of sockets, it's a no-op on linux
<RX14> which sucks
<oprypin> :(
<RX14> because obviously
<RX14> you couldn't block on a file
<RX14> it's "instant"
<RX14> and as txdv said
<RX14> linux provides absolutely no usable primatives for it
<RX14> it's impossible to do without a threadpool
<txdv> linux has aio
<RX14> yes
<RX14> i said usable
<RX14> :)
<Papierkorb> kinda hilarious considering that network attached storage has always been popular in enterprise
<RX14> ^
<oprypin> so that's why my text editor freezes
<RX14> if it uses libuv it uses a threadpool for file IO
<RX14> "The kernel aio interface is not wrapped by libc, only works on some file systems, has some odd-er alignment+size requirements and only supported by linux"
<RX14> basically the alignment requirements kill it
<RX14> you need to align your file reads and writes or something
<RX14> which makes it unusable for general-purpouse applications
<txdv> and nobody is willing to fix it
<txdv> because that would mean breaking file io on linux and nobody wants to deal with that
<RX14> how would it beak file IO?
<RX14> surely you can produce both old and new behaviousr with a new syscall, or even just a new IOCTL
<RX14> or a FD option
<txdv> you can, but it would mean that you need to rewrite all of the file io code
<txdv> o man
<txdv> i need to get into kernel developing
<Papierkorb> AIO is a completely separate kernel API. Both APIs already co-exist
snsei has joined #crystal-lang
Tuxified has joined #crystal-lang
<crystal-gh> [crystal] mverzilli opened pull request #4923: Remove empty string as alias for --no-debug (master...fix/empty_no_debug_option_alias) https://git.io/v5EkQ
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] RX14 closed pull request #4923: Remove empty string as alias for --no-debug (master...fix/empty_no_debug_option_alias) https://git.io/v5EkQ
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#0c5a8d7 (master - Remove empty string as alias for --no-debug (#4923)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/271457630
<travis-ci> crystal-lang/crystal#0c5a8d7 (master - Remove empty string as alias for --no-debug (#4923)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/271457630
rohitpaulk has quit [Ping timeout: 246 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
Tuxified has quit [Read error: Connection reset by peer]
ShalokShalom has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 255 seconds]