ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.22.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<FromGitter> <fridgerator> @jwoertink there isn't much in regards to AWS support right now it seems. I was able to do some s3 uploading using `awscr-signer` but it was a lot of manual work
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
splitty_ has quit [Ping timeout: 240 seconds]
zaiste has joined #crystal-lang
mark_66 has joined #crystal-lang
zaiste has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zipR4ND has joined #crystal-lang
splitty_ has joined #crystal-lang
zaiste has joined #crystal-lang
gewo has joined #crystal-lang
zaiste has quit [Quit: Textual IRC Client:]
zipR4ND has quit [Ping timeout: 268 seconds]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
zipR4ND has joined #crystal-lang
<FromGitter> <arc512> Hi all I kinda crystal and it seems a good language with good semantics like Go and Elixir , I never really liked Ruby but it seems geared towards Ruby devs and seems like I'd have to learn Ruby to learn crystal
vegai has left #crystal-lang ["User left"]
<FromGitter> <bew> Hi @arc512 , You can learn Crystal without knowing Ruby (I did that!)
<FromGitter> <drosehn> crystal's syntax is certainly inspired by ruby, but you don't need to learn ruby in addition to learning crystal.
<FromGitter> <drosehn> See if you like crystal for what it is, and if so then don't worry about the talk about ruby.
<FromGitter> <bew> in the end, you learn some things usable in Ruby too, but it's NOT a requirement, and the 2 languages are not meant to be compatible. like @drosehn, the syntax is inspired from ruby, but that's almost all.
<FromGitter> <arc512> @bew @drosehn Thanks guys
zipR4ND has quit [Ping timeout: 246 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
splitty_ has quit [Ping timeout: 240 seconds]
zipR4ND has joined #crystal-lang
<crystal-gh> [crystal] mverzilli closed pull request #3809: Replace /bin/bash with /bin/sh (master...replace-bash-with-sh)
<RX14> I feel like learning proper compiler work today
<RX14> going to try making a PR for as it seems fairly trivial
<crystal-gh> [crystal] RX14 opened pull request #4395: Prevent None and All members in flags enums (master...feature/flags-enum-error)
<RX14> that was surprisingly easy
<RX14> the compiler code is pretty clean
<FromGitter> <bew> @RX14 you know so much about crystal and everything, and you say that it's your first contrib? Oo
<FromGitter> <bew> (to the compiler)
<RX14> to the compiler, yes
<RX14> i've picked up bits and pieces through the years though :P
<RX14> darn, looks like i broke specs
<FromGitter> <bew> Oh ok, I just understood the difference after sending the message^^
<FromGitter> <bew> at least youc an compile them x)
<RX14> hmm?
<RX14> oh can you not compile the specs because you have < 8gb ram?
<FromGitter> <bew> I have 8gb, but I have 5gb usable
<RX14> did you try using --no-debug --threads=1
<RX14> it might cut down on that memory
<RX14> maybe just enough to compile the specs
<RX14> or even just enabling swap should do the trick
<RX14> add ~4gb swap and set swappiness to 1
<FromGitter> <bew> I have ssd (no hdd), I don't want swap on it...
<RX14> ssd is better for swap because it's faster
<RX14> and no, you won't wear it out
<RX14> especially with swappiness=1
<FromGitter> <bew> hmm I'll need to look into that stuff... soon...
<RX14> it takes a LOT to wear out a SSD
<RX14> like, a year or more of 100% utilization
<RX14> which just doesn't happen
<FromGitter> <bew> u right
<FromGitter> <bew> even with no debug and 1 thread, the fork fail...
splitty_ has joined #crystal-lang
<FromGitter> <bew> I don't have time right now, but I have an idea, I need to do some tests..
<RX14> i would recommend swap though
<crystal-gh> [crystal] ysbaddaden opened pull request #4396: Drop LLVM 3.5 and LLVM 3.6 support (master...drop-llvm-35-and-36-support)
<crystal-gh> [crystal] RX14 closed pull request #3595: [WIP] Generic Select for IO (master...feature/io-select)
A124 has quit [Quit: '']
A124 has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
<FromGitter> <jwoertink> Thanks @fridgerator. I think having a solid AWS shard will be a huge thing. I started reading through some of the API docs, and my brain just shut off lol. That stuff reads like ikea furniture instructions
<FromGitter> <bew> I'm working with AWS stuff currently, and yes, the documentation is just insane!!
<FromGitter> <ltran> Aws documentation?
<FromGitter> <jwoertink> yeah
<FromGitter> <ltran> ya me too im reading through it and like i have to keep going back and rereading the section o_O
<FromGitter> <jwoertink> Just the S3 docs start by giving you 3 pages of docs on the headers before finally telling you what URL you're supposed to post to
<FromGitter> <fridgerator> Yeah the docs are crazy. I also started looking at the ruby aws gem with the thought of porting it to crystal... yeah thats not happening.
<FromGitter> <fridgerator> at least not in my spare time
<FromGitter> <jwoertink> lol
<FromGitter> <jwoertink> I did the same thing
<FromGitter> <fridgerator> It could perhaps be a community effort, someone would just have to set up the infrastructure and get the ball rolling
<FromGitter> <fridgerator> but from what I remember, the ruby gem reads from a json file and dynamically creates methods based on it, or something like that
<FromGitter> <jwoertink> yeah, it's crazy how that gem works
<FromGitter> <jwoertink> I wouldn't mind starting an org on github like `aws-crystal`. I'd like to see each part broken out in to separate shards. Like `aws-crystal/s3` `aws-crystal/cloudfront`, etc...
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
zipR4ND has quit [Ping timeout: 255 seconds]
p0p0pr37 has quit [Read error: Connection reset by peer]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
A124 has quit [Quit: '']
A124 has joined #crystal-lang
A124 has quit [Client Quit]
A124 has joined #crystal-lang
zipR4ND has joined #crystal-lang
A124 has quit [Quit: '']
A124 has joined #crystal-lang
A124 has quit [Client Quit]
A124 has joined #crystal-lang
<FromGitter> <bew> I'd say, first create one or two complete shards for aws, then you'll see if it's worth...
<crystal-gh> [crystal] RX14 opened pull request #4397: Add range access methods to BitArray (master...feature/bitarray-range)
<FromGitter> <sdogruyol> It's great to have in flight WiFi
<FromGitter> <sdogruyol> Feels like living in future lol
<FromGitter> <ltran> lol. vpn?
<FromGitter> <jwoertink> lol
<FromGitter> <ltran> serdar you heading to sf?
<FromGitter> <sdogruyol> Yeah omw to sf
<FromGitter> <ltran> nice. im already in sf =)
<FromGitter> <ltran> i work here ¬.¬
<FromGitter> <jwoertink> If you guys haven't been yet, try out Ike's Love and sandwiches
<FromGitter> <sdogruyol> I'm open for suggestions
<FromGitter> <jwoertink> and if you're feeling daring, order the kryptonite :D
<FromGitter> <sdogruyol> @ltran are you coming to codecamp
<FromGitter> <ltran> i couldnt get the time off work =/
<FromGitter> <sdogruyol> @jwoertink i am getting married when i get back from SF, so no
<FromGitter> <ltran> but im down the street :|
<FromGitter> <ltran> Are you all recording it / streaming?
<FromGitter> <sdogruyol> @ltran feel free to drop by
<FromGitter> <sdogruyol> I got some lokum
<FromGitter> <ltran> lokum?
<FromGitter> <sdogruyol> 😂😂
<FromGitter> <jwoertink> congrats! Gotta fit in to that suit when you get back ;)
<FromGitter> <ltran> is that food?
<FromGitter> <sdogruyol> Turkish delight it is
<FromGitter> <ltran> ya just gogoeld it XD omg looks so good
<FromGitter> <sdogruyol> @jwoertink yeah that's complicated
<FromGitter> <sdogruyol> I really believe that codecamp is gonna be awesome
<FromGitter> <sdogruyol> So many advanced Crystal users gathering
<FromGitter> <jwoertink> I'm sad I'm missing it :cry:
<FromGitter> <sdogruyol> That's sad
<FromGitter> <sdogruyol> There's a lot to learn especially from @waj
<RX14> this has been a really productive afternoon lol
<FromGitter> <sdogruyol> @rx14 sup
<FromGitter> <jwoertink> still working on that compiler thing?
<RX14> well it's pretty much done
<RX14> just pushed the last build fix for LLVM on there
<FromGitter> <sdogruyol> IMHO there are a lot of quick wins at compiler
<FromGitter> <sdogruyol> We just need more people chipping in
<RX14> yeah
<FromGitter> <sdogruyol> Do you know when the next techempower benchmarks coming in
<RX14> 14?
<RX14> it's allready been done
<RX14> they're just doing the website stuff
<RX14> the improved crystal is waiting for 15
<FromGitter> <sdogruyol> 15
<RX14> the next previews then? no idea
<RX14> after 14 I guess
zipR4ND has quit [Ping timeout: 255 seconds]
<FromGitter> <mgarciaisaia> Can anyone recall quickly of a specific platform in which to build Crystal that doesn't have bash available?
<FromGitter> <mgarciaisaia> The build script (`bin/crystal`) asks for `sh` (`/usr/bin/env sh`), but it has some bash-specific code. I'm not sure if it's best to "downgrade" it to sh, or just change the shebang to bash
<FromGitter> <jwoertink> Windows?
<FromGitter> <jwoertink> lol
<FromGitter> <mgarciaisaia> I'm thinking about some specific toaster model that Julien has ported Crystal to and *doesn't* run bash yet :P
<FromGitter> <fridgerator> lol
<RX14> @mgarciaisaia alpine
<RX14> it doesn't have bash by default
<RX14> only sh
<FromGitter> <mgarciaisaia> :(
<FromGitter> <mgarciaisaia> holy sh :P
<FromGitter> <mgarciaisaia> Thanks, RX14!
<RX14> you can install bash
<RX14> but it's not there by default
<RX14> and even then it's not linked to sh
<oprypin> ubuntu's sh is not bash
<FromGitter> <mgarciaisaia> Just talked with MartinV, it was changed in a PR a couple of hours ago, and somehow the tests didn't cover it
<FromGitter> <mgarciaisaia> To be clear: we *were* using `/bin/bash`, we've just merged a PR that changed it to `sh`, but it seems the test suite don't cover that change - and so it's bugged now. I'm already fixing it anyways
wuehlmaus has quit [Quit: Lost terminal]
sp4rrow has joined #crystal-lang
DeBot has joined #crystal-lang
wuehlmaus has joined #crystal-lang
zipR4ND has joined #crystal-lang
<FromGitter> <bew> Why the internal representation of a `BitArray` is a `Pointer(UInt32)` which takes 4 bytes for each bit, and not something smaller, like a `Pointer(Bool)`, which would be 1 bit for each bit? Did I missed something in the implementation? Or is `BitArray` very inefficient memory wise?
<Papierkorb> I doubt that BitArray doesn't use actual bits bew
<Papierkorb> bew, yep, it accesses the bits directly, as you'd expect from a BitArray
<RX14> @bew Pointer(Bool) would be 1 byte per bool, BitArray is 1 bit per bool
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<jhass> so it wastes size % 32 bits
DeBot_ has joined #crystal-lang
DeBot has quit [Ping timeout: 255 seconds]
<FromGitter> <bew> Hmm forgot sizeof give size in bytes... In BitArray the only constructor I see is a `Pointer(UInt32).malloc(malloc_size, value)` where does `malloc_size` comes from?
<RX14> no, 32-(size % 32) right?
<RX14> @bew it's a private method at the bottom...
<FromGitter> <bew> Nvm i've found it.....yes....
<jhass> mh, right
<FromGitter> <bew> Still can't get used to method call without parentheses... (maybe I'm tired too..)
Ven has joined #crystal-lang
Ven is now known as Guest53690
<jhass> now who wants to implement BitArray#<< ? :D
<FromGitter> <bew> And there is `BitArray#[Int]` missing too iirc
<RX14> jhass, I made a note in my PR that shrinking a bitarray could break my == impl lol
sp4rrow has joined #crystal-lang
euma3us has joined #crystal-lang
<euma3us> hi
<FromGitter> <bew> Hello euma3us!
euma3us has quit [Quit: Page closed]
bmcginty has quit [Ping timeout: 240 seconds]
bmcginty has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
Guest53690 has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest11399
<FromGitter> <bew> @RX14 do you have the link for the discussions about `equal(other)` giving false ? I really don't know what to type in the search box..
<RX14> i tried searching
<RX14> but it would break everything
<RX14> because what about unions?
<RX14> if you had an Int32 | String, using == should work but it'd fail to find an override
<RX14> that's basically the == conversation tl;dr
<FromGitter> <bew> Ah unions... You mean BitArray == Int32 | String ? Or were you taking another example?
<RX14> yes basically that
<RX14> well
<RX14> more like
<RX14> BitArray#==(BitArray | Nil)
<RX14> but there's no overload for Nil, what do?
<FromGitter> <bew> Hmm i see
zipR4ND has quit [Ping timeout: 240 seconds]
Guest11399 has quit [Ping timeout: 268 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 255 seconds]
<FromGitter> <jwoertink> is a `unsigned int` in C the same as `LibC::UInt`?
<FromGitter> <carsonbaker> Yes.
<FromGitter> <jwoertink> as well as `unsigned short` being `LibC::UShort`?
<FromGitter> <carsonbaker> alias UShort = UInt16
<FromGitter> <jwoertink> Is there a `LibC::UChar` for `unsigned char`?
<FromGitter> <carsonbaker> look in src/
<FromGitter> <carsonbaker> ```code paste, see link``` []
<Papierkorb> jwoertink, there is, almost all C integer types are mapped similarly
<Papierkorb> jwoertink, e.g. LibC::SizeT is a thing too
<FromGitter> <jwoertink> ah! Sweet. thanks
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
<FromGitter> <jwoertink> When porting over a C lib, if there's a struct where the name of it is all lower case, can I just capitalize the first letter, does that work?
<Papierkorb> jwoertink, you can rename the structures, enums, etc., to your hearts desire, doesn't make any difference
<FromGitter> <jwoertink> ```typedef struct ⏎ { ⏎ unsigned int thread_count; ⏎ } configuration``` []
<FromGitter> <jwoertink> and crystal will magically know which one I'm talking about?
<Papierkorb> No it doesn't, but it doesn't have to
<Papierkorb> A struct in C and Crystal-lang is just a bunch of bytes with hopefully the same structure one expects
<FromGitter> <carsonbaker> crystal only sees what you've defined in crystal. i can have struct Foo in C and struct Bar in Crystal, but if they map to the same sort of bytes, it doesn't matter.
<Papierkorb> The "name" or anything is never transmitted, only the structure data OR a pointer to it
<FromGitter> <jwoertink> ahhh
<FromGitter> <jwoertink> ok
<FromGitter> <jwoertink> awesome!
<Papierkorb> jwoertink, that's why it's super important that you 1) get the structure right in terms of field sizes and count 2) watch out for a ((packed)) attribute in C and replicate it as @[Packed] in Crystal
<Papierkorb> jwoertink, If you say have a struct which is 5x int, and you replicate that as 4x int in Crystal, things will blow up but it'll compile fine, and if you're unlucky, even appear to work for some time
<FromGitter> <jwoertink> oh, that's good to know
<Papierkorb> That's because the receiving function *expects* the passed struct to have the correct structure (including size), it can't even check if it's the case
<FromGitter> <jwoertink> ok, so I can't just implement half of the items in the struct. I need to implement exactly what it has to know that it lines up the same
<FromGitter> <carsonbaker> for sure. :-)
<FromGitter> <carsonbaker> what library are you porting?
<FromGitter> <jwoertink> well, I'm more trying to learn more about this whole C lib binding stuff. but I'm using as my example
<FromGitter> <jwoertink> but I ported over SDL2_Mixer which seems to work, but I'm guessing there's going to be issues with it
<FromGitter> <jwoertink> because for the Enums, I just implemented the ones that would be called so that way it would compile; which it does.
<FromGitter> <carsonbaker> right. yeah, if you're not using a definition in crystal, you don't have to write the binding.
<FromGitter> <carsonbaker> but there's going to be a lot of undefined behavior if you're passing structs around that aren't exactly what haywire expects. i don't know anything about haywire, but i would imagine those struct fields are important to its operation.
<FromGitter> <carsonbaker> it's not a lot to deal with though. you only have a few in that header file.
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <carsonbaker> sometimes the frustrating thing for me about writing bindings is dealing with macros. since that's just code that gets inlined, there's no function to bind to, so you're up a creek without a paddle, unless you want to rewrite the macro in crystal lang.
<FromGitter> <jwoertink> ah yeah. That starts to go over my head a bit
<FromGitter> <jwoertink> @carsonbaker There's this one definition in this that has `http_request_callback callback`. What would that `callback` be in Crystal?
<FromGitter> <jwoertink> just a proc?
<FromGitter> <carsonbaker> yep
<FromGitter> <jwoertink> :thumbsup:
<FromGitter> <carsonbaker> but you can't put Proc in the binding definition. use Void*
<FromGitter> <carsonbaker> and then use .to_pointer when you pass in your Proc reference
<FromGitter> <jwoertink> `http_request_callback : Void*` ?
<FromGitter> <carsonbaker> yep
<FromGitter> <jwoertink> then calling it would be `-> {}.to_pointer` ?
<FromGitter> <carsonbaker> yep
<FromGitter> <jwoertink> awesome
<FromGitter> <jwoertink> thanks!
<FromGitter> <jwoertink> Thanks @bew :)
<FromGitter> <bew> @carsonbaker see the link, you can put proc types in fun declarations!
<FromGitter> <carsonbaker> yeah, that's the proper way to do it. my way is hacky and not as type-safe.
<FromGitter> <carsonbaker> :-) thanks!
<FromGitter> <bew> Like `fun callback(f : Int32 -> Int32)`
<FromGitter> <bew> Yw :smile:
bmcginty has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<FromGitter> <werthen> New to crystal, got a question regarding generics. Why does ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ give me `instance variable '@digits' of Series must be Array(Int), not Array(Int32)`? Int is a superclass of Int32, so it should still check out right? Am I missing something in the docs or is this not possible? Thanks! []
<FromGitter> <drosehn> I think you have to pick a specific-size `Int` for that. `Int32`, `Int64`, etc.
<Papierkorb> werthen, Int is special and doesn't exist on the machine itself, you can't use it there. Use Int32 instead.
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
<FromGitter> <werthen> Okay but lets say I need an array of Animals somewhere. I define a Dog class which inherits from animal. Can I define the array as `@animals : Array(Animal)` and then for example initialise it with `[]`?
<FromGitter> <carsonbaker> I think so, yeah. The Int case in an array is special because while Animal and Dog are really just pointers, Int can be a lot of different sizes so Array doesn't know what to do.
<FromGitter> <carsonbaker> ```class Animal; end ⏎ class Dog < Animal; end ⏎ fur = [] ⏎ puts fur``` ⏎ ⏎ outputs ⏎ [#<Dog:0x10fafdff0>] []
<FromGitter> <carsonbaker> er sorry.
<FromGitter> <carsonbaker> edited.. there we go.
<FromGitter> <werthen> right, I think I got it. I was trying the same with the Animal, but it also complained about the type not being correct. It just inferred `[]` as being `Array(Dog)`, and it didn't automatically cast it to the array I defined at the top of the class
<FromGitter> <werthen> Thanks guys