ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
hightower has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <doughsay> Is it possible to compile shared object files in Crystal that another Crystal program could then dynamically link to?
<FromGitter> <jwaldrip> super helpful `?` @oprypin
<FromGitter> <jwaldrip> Let me ask again
<FromGitter> <jwaldrip> Given the following code, inthe crystal project
<FromGitter> <jwaldrip> is ScalarStyle::ANY allowed to be any type?
<FromGitter> <jwaldrip> any type in crystal
<FromGitter> <jwaldrip> I am fixing some underlying issues with crystal and yaml, would love some guidance on what the behavior of that event style should translate to.
<FromGitter> <jwaldrip> @johnjansen do you have a perspective perhaps?
<FromGitter> <jwaldrip> you're a smart guy
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <mgarciaisaia> @jwaldrip I really don't know that code, but from the context I would tell it means *any of the other possible `ScalarSytle`s* rather than *any Crystal object you like*.
greenbigfrog has quit [Quit: The server of my BNC just shutdown or got killed!!!]
<FromGitter> <johnjansen> @jwaldrip i wish i could give you some … i got lost in the whole pull parser mapping yaml::any area yesterday … still havent recovered the mental energy ;-) … plus its friday and i spent the day laughing at the news
snsei has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <drujensen> hello crystallites! I have a question and can use some help
<FromGitter> <drujensen> is there a way to get the index of a match with `gsub`?
<FromGitter> <sdogruyol> Hey @drujensen
<FromGitter> <drujensen> in ruby, you can do something like this:
<FromGitter> <drujensen> ```string.gsub(/()/).with_index { |match,index| match[index] }```
<FromGitter> <drujensen> I can’t seem to find an equivalent in crystl
<FromGitter> <johnjansen> hey drew, do you want each match or just the first
<FromGitter> <johnjansen> damn auto complete Dru
<FromGitter> <drujensen> here is what I would do in ruby:
<FromGitter> <drujensen> ```I like you1, you2, you3, and you4.``` []
<FromGitter> <johnjansen> ahhh the enum thing
<FromGitter> <johnjansen> so .each_with_index should work in crystal i think
<FromGitter> <drujensen> ``````
<FromGitter> <johnjansen> haha funny, i cant tell which docs are which, crystal and ruby look the same
<FromGitter> <drujensen> I’m getting: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <LuckyChicken91_twitter> just look up if there is "" or ""
<FromGitter> <johnjansen> yeah, it was out of view ... anyway
<FromGitter> <johnjansen> @drujensen can you stick the code in play
<FromGitter> <johnjansen> im on a new machine and its not set up yet
<FromGitter> <johnjansen> shite yes @dru ... there is no enum version of gsub
<FromGitter> <johnjansen> tell me .. in ruby is the `with_index` giving you the char index of the match, or just a number representing `no_of_matches_seen_already + 1` ?
<FromGitter> <johnjansen> if its the later you might need to do this
<FromGitter> <drujensen> I think its the number
<FromGitter> <drujensen> aahh, nice! @johnjansen that will work. thanks!
<FromGitter> <johnjansen> im inclined to think it is too, since i think you are getting enum behaviour
snsei has quit [Remote host closed the connection]
<FromGitter> <drujensen> Next crystal codecamp I will buy you a beer
<FromGitter> <drujensen> hopefully at a bar with a better bartender than last time. lol
<FromGitter> <johnjansen> @drujensen no need my friend ... by the way im hacking on a reverse proxy to stand in front of your kemal (or stdlib) http apps
<FromGitter> <drujensen> excellent
<FromGitter> <johnjansen> so you can do rolling updates with no downtime ... without NGINX of HA or whatever
<FromGitter> <johnjansen> ok bed for me ... catch up soon
<FromGitter> <drujensen> k
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <LuckyChicken91_twitter> how can I get the bits of an integer? for example if im defining `myint = 56i64` how can I check then which bit it is? maybe with `bit?`/`bits?`
<FromGitter> <johnjansen> one more thing before bed i suppose
rohitpaulk has joined #crystal-lang
<FromGitter> <johnjansen> ```56_i64.to_s(2)```
<FromGitter> <johnjansen> for binary
<FromGitter> <johnjansen> depends on what you want to do ... ⏎
<FromGitter> <johnjansen> masks are easy too
<FromGitter> <johnjansen> not exactly what you asked but gives you the idea
<FromGitter> <LuckyChicken91_twitter> i just want to know the type
<FromGitter> <LuckyChicken91_twitter> is it 64 bit? is it 32 bit? is it 16bit? etc
<FromGitter> <johnjansen> huh?
<FromGitter> <johnjansen> what about ``
<FromGitter> <johnjansen> or just `56_i64.class`
<FromGitter> <LuckyChicken91_twitter> oooh
<FromGitter> <LuckyChicken91_twitter> i think i will make an method of this
<FromGitter> <LuckyChicken91_twitter> how can I btw define an UInt64?
<FromGitter> <LuckyChicken91_twitter> 62ui64 didnt work
<FromGitter> <codenoid> ```code paste, see link``` ⏎ ⏎ CMIIW []
<FromGitter> <straight-shoota> @bew yes, for #4851 I mean a something like `# rescueing exception to avoid printing useless stacktrace`
Yxhuvud has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> someone know how i can define an uint64
<bmcginty> luckychicken91_twitter: num
<bmcginty> LuckyChicken91_twitter: ` 5` for example
maxpowa has quit [Ping timeout: 240 seconds]
maxpowa has joined #crystal-lang
<FromGitter> <straight-shoota> @LuckyChicken91_twitter just look at the docs:
<FromGitter> <straight-shoota> @bmcginty that's possible but only allows to create values in the range or an int32! Better to use a literal: `1_u64`
<FromGitter> <LuckyChicken91_twitter> how can I define methods which i can use on some things? i mean methods like `myvariable.upcase` for example. if i would want to define a method like this i could use the method like this: `mymethod(myvariable)`
<FromGitter> <sdogruyol> Morning everyone
<FromGitter> <LuckyChicken91_twitter> good morning
<FromGitter> <krypton97> morning here
<FromGitter> <krypton97> just found this benchmarking tool
<FromGitter> <krypton97> has a nice output
fenicks has joined #crystal-lang
<FromGitter> <codenoid> is my cr version wrong ?
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
<FromGitter> <sdogruyol> why?
<FromGitter> <codenoid> ```code paste, see link``` ⏎ ⏎ @sdogruyol []
bmcginty has quit [Ping timeout: 240 seconds]
bmcginty has joined #crystal-lang
<FromGitter> <sdogruyol> What's your content type?
<FromGitter> <sdogruyol> Are you sure of the curl command
<FromGitter> <codenoid> `application/x-www-form-urlencoded, application/json` , yes,
<FromGitter> <codenoid> i mean, is my `crystal_version` http client having a same function like `curl_version` ,
<Groogy> Morning!
<FromGitter> <sdogruyol> Morning
<FromGitter> <bew> Morning here too!
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <bew> @straight-shoota got it, I'll add that comment
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<Groogy> and now textures work ^^
<FromGitter> <bew> holy-awesomeness, nice!
<Groogy> though there weren't any FreeImage bindings so I had to ugly hack something together :/
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <krypton97> are you doind binding to opengl :3 ?
<FromGitter> <krypton97> doing*
<Groogy> no I am using bindings already done to make something out of them ;D
<Groogy> example of usage of my framework boleite ->
<FromGitter> <krypton97> This api seems much lighter than the c++ one
<Groogy> well that's because I am implementing a Crystal abstraction layer or whatever :P framework is done so the backend can be replaced with other hardware interfaces as well
<Groogy> Vulcan, DirectX etc. without your own code changing
<FromGitter> <krypton97> Screw Vulkan, that took me like 90 lines only for creating the window x_x
<Groogy> yeah I tried vulkan before and it was... ugh painful
<Papierkorb> Wasn't that the intention of vulkan? No pun intended, it's super bare metal, and it probably shows
<Groogy> yeah it is
<Papierkorb> Note that I have no idea about graphics APIs, and what makes a good one
<Groogy> which is also why OpenGL probably will never die as well
<Papierkorb> Yeah didn't even the Vulkan folks say that in the introduction?
<Papierkorb> "use OpenGL except if you need Vulkan"
<Groogy> the Vulkan folks are Khronos they commitee that defines OpenGL as well
<Groogy> yes :P
<Groogy> the committe*
<FromGitter> <krypton97> Doesn
<FromGitter> <krypton97> Vulkan use the win api?
<Groogy> no you were probably reading a tutorial on how to get started
<Groogy> Vulkan is just a standard for how to interact with graphics drivers essentially
<Papierkorb> Groogy: Though considering the awful OpenGL code in drivers, is there already work done to reimplement the OpenGL API on top of Vulkan? Would that actually give any performance benefit?
<FromGitter> <krypton97> nvm
<Groogy> but you still need to create a OpenGL or a Vulkan context through platform specific interfaces (like the Win api to create a window)
<Groogy> Papierkorb as far as I know, no but I think to save cost that's what the gfx card makers are just gonna do
<Groogy> because the gfx cards still can't drop DirectX9 or even OpenGL 1.2 support
<Groogy> keep in mind OpenGL and Vulkan kind of works like the C++ standard, some industry leaders decide on things and then it's up for the companies to implement it
<Papierkorb> Qt update, it should now be possible to write everything required for Qt integration into libevent (and thus, Crystals "main loop") to be done from pure(-ish) Crystal. The last day I got rid of the last obstacle towards that, so even that part won't need custom C++ code. yay.
<Papierkorb> Groogy: Yeah standards are meant to be not followed, ugh. Never got into graphics or game dev in general, never knew how to start and do something useful
<Papierkorb> Though I'm not even interested in building a Game, I'm only interested in the underlying engine partes...
<Groogy> Huh in more actual working terms what does that mean with Qt integration? That Qt can hook into the fibers?
<Papierkorb> Yes, that means you'll be able to use the Qt (on the long run) like a library besides normal Crystal code
<Papierkorb> Won't be possible for the TechPreview, but that's one of the main things to do after the release of that stuff.
<Papierkorb> Really important to me. QNetworkAccessManager is just no fun to use in a non-C++/Qt-native world (Well, bindings could be made of course). We already have networking code. Etc.
<FromGitter> <bew> wow, did you integrate Qt into crystal's scheduler? or crystal into qt's main loop?
<Papierkorb> Intend to, not done yet. That part is more complex. I just made it possible that it can be done using pure Crystal code, and without writing any further C++ code just on that
<Papierkorb> And it's Qt
<Papierkorb> And it's Qt's event loop into LibEvent, which provides the event loop for Crystal programs
<Groogy> noice
<Groogy> gotta get some coffee so I can start working on the next step
<Papierkorb> Groogy: I'm actually interested, it's curiosity first and foremost, to build a simple-ish 3D editor in Crystal, using Qt for UI. The missing part would be a usable 3D engine, though you're right now covering that part. Not as competition to Maya or anything, just as demo what can be done with Crystal.
<FromGitter> <abidon> Hi guys, how can i write a Slice(UInt8) to IO in binary format, actually it writes something like this: `Bytes[130, 170, 108, 97, ...]`
<Papierkorb> And that it may be a viable candidate for GUI programs in a few years time
<Papierkorb> abidon, you're probably using IO#print. Use IO#write instead for this.
<Groogy> Well mine will be a full framework for input, and so on
<Groogy> so it might be a bit heavy weight but you could probably use only parts of it
<Papierkorb> I've used Qt for some years, now I'm binding it. I never understood the "muh lighweight" fanatism anyway.
<FromGitter> <bew> Papierkorb, ok, I'll wait for your first release, it might be clearer to read code.. nice idea to do a simple big-software to showcase possibilities
<Groogy> actually now that I think of it, could probably write a backend implementation for your Qt binding
<Groogy> and that way hook in everything to work as Qt expects it
<Papierkorb> Yo that'd be QGLWidget for OpenGL, or we can also grab a handle to a native widget container, which gives you a window handle to draw in
<Papierkorb> Which would neatly abstract away the remaining part of the platform-specific code :3
<Groogy> yeah don't think it would be that hard to integrate stuff into your Qt project
<Groogy> would just need to implement a QtOpenGL backend compared to the GLFWOpenGL backend I have right now and tell the framework to pick that backend
<Papierkorb> For OpenGL there's already something in Qt. It'll give you a context and then you go wild
<Groogy> yeah the backend in my framework is just what handles the low-end magic so you don't have to care like what opengl command to use, etc.
<Papierkorb> Or one does that manually, which isn't too bad either
<Groogy> it just needs a opengl context to have been created (Which Qt does)
<FromGitter> <bew> also, what is the second request for? what do you get from it?
<FromGitter> <bew> oops sorry wrong channel
<FromGitter> <Qwerp-Derp> ```code paste, see link``` []
<FromGitter> <Qwerp-Derp> How do I convert `real_fn` to something that isn't a closure?
<Papierkorb> Qwerp-Derp, by not catching any variables in the boy
<Papierkorb> body*
<Papierkorb> Doesn't `UI` do proper proc wrapping..=
<Papierkorb> ?
<FromGitter> <Qwerp-Derp> ???
<FromGitter> <Qwerp-Derp> I'm making objects for the LibUI binding
<FromGitter> <Qwerp-Derp> Do you need all of the code?
<Papierkorb> Oh well, that looks "fun". You see that `data` argument passed in?
<FromGitter> <Qwerp-Derp> Yep
<Groogy> you could pass in fn there
<Groogy> guessing it is the nil argument
<Papierkorb> You have to pass the `fn` through that (that'd be the nil in your call below), but you *need* to Box it. Have a look in the C binding docs, it's documented how
<FromGitter> <Qwerp-Derp> I'll have a look, I'm a complete noob to C though
<FromGitter> <Qwerp-Derp> So I would set `data` to a boxed version of `fn`?
<Papierkorb> yes, and in your real_fn, you unbox it to get the `fn` back, which you then call
<FromGitter> <Qwerp-Derp> How do I set `data` though? Do I set it through the default argument value?
DTZUZO has quit [Ping timeout: 248 seconds]
<Papierkorb> See that `nil` you pass to UI below? What pointer you pass there will end up as `data`
<FromGitter> <abidon> I was using `io << bytes`
Groogy has quit [Quit: WeeChat 1.9]
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #4852: Correct chained comparison `to_s` to fix #4708 (master...fix/crystal/to-s-comparison-correctly)
<FromGitter> <jwaldrip> How is a tuple represented in YAML?
rohitpaulk has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
<Papierkorb> ... erm .. no idea. jwaldrip, just try #to_yaml one in crystal play
<Papierkorb> I'd expect a yaml list, but not sure
<FromGitter> <jwaldrip> It is a list
<FromGitter> <jwaldrip> I knew there must have been an issue: ⏎ ⏎
<Papierkorb> jwaldrip, `Tuple(Int32)` is `{123}`. A tuple is a 100% static structure: View it as `struct`, rather than as `Array`
<FromGitter> <jwaldrip> so then why would it to_yaml into a list, but not from_yaml from the same list
<Papierkorb> {1,2,3} is a `Tuple(Int32, Int32, Int32)`, they're not the same type at all
<Papierkorb> Tuple is a structure, not a (sequential) container
<FromGitter> <jwaldrip> Got it
<FromGitter> <jwaldrip> oops
<FromGitter> <jwaldrip> should have known that
<crystal-gh> [crystal] asterite opened pull request #4853: Optimize String::Builder#write_byte (master...feature/optimize-string-builder-write-byte)
<FromGitter> <codenoid> or is there any alternative for that ?
rohitpaulk has joined #crystal-lang
w-p has joined #crystal-lang
<crystal-gh> [crystal] akzhan opened pull request #4854: Up to date Crystal changelog (master...update-crystal-changelog-0.23.0)
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <fridgerator> @sdogruyol when you were benchmarking websites, did you evaluate Thor at all?
<FromGitter> <johnjansen> someone needs to benchmark the benchmarking tools @fridgerator
<FromGitter> <fridgerator> lol
<FromGitter> <fridgerator> but what about benchmarking the benchmarking benchmarking tools?
<crystal-gh> [crystal] asterite opened pull request #4855: Improve JSON and YAML exception locations (master...feature/improve-json-yaml-error-location)
alex`` has quit [Quit: WeeChat 1.9]
rohitpaulk has quit [Ping timeout: 240 seconds]
<RX14> Papierkorb, re: qt, you're writing bindings?
<RX14> that's really really cool
<Papierkorb> RX14: Yeah, public TechPreview Monday or Tuesday
<RX14> could you give an overview of the obstacles you had?
<Papierkorb> "C++". Hard to tell what'd be an obstacle, I've done C++/Qt for a few years, so I still know most of the ways. Most of it was coming up with a way of mapping that to Crystal. The most annoying part was probably getting Clang (or rather, the clang-based parser) to tell me what's an Qt signal, so I can map them as such.
<RX14> doesn't qt use a preprocessed C++?
<RX14> are you talking about extracting what's a signal from that?
<Papierkorb> In the end, C++ and Crystal are both static languages. Thankfully, C++ is stricter than Crystal, so that's useful. I fought a bit with how I'd realize ownership (GC), but then I figured I could simply use the C++ bindings of Boehm, which works great - for now at least
<RX14> so i assume you autogenerated most of the bindings?
<Papierkorb> I auto-generate almost exclusively
<RX14> thats good
<Papierkorb> The manual binding part comes down to making some "left overs" nicer. Like getting QApplication to grab the ARGV_UNSAFE automatically, and doing that in a "correct" way.
<Papierkorb> Well yes and no. C++/Qt is not preprocessed. What it has is the "moc", which generates meta-data for runtime reflection of QObject based classes.
<Papierkorb> That doesn't interfere at all with the binding generation. We happen to collect similar data in parts of course.
<RX14> well i'm glad someone who knows QT is doing these bindings
<Papierkorb> Which gets me to a fun fact: In the future, I'll try to generate this meta-data in Crystal. Then those classes will look completely native to Qt at run-time.
rohitpaulk has joined #crystal-lang
<RX14> i've always thought of doing it myself but I never did C++ Qt so i'd have to learnt hat first
<Papierkorb> For that we just have to re-implement the correct virtual methods, and subsequently, the API of that. Nothing out of the ordinary, just fun macro magic
<Papierkorb> And as virtual method overloading from Crystal already works, that's perfectly possible
<Papierkorb> Hopefully the bindgen will evolve into something more and more poweful, covering larger sets of C++ features and eventually C. Much of the required features should already be in, it's about 70% work in the crystal-part of the bindgen, and 30% in the C++ part I'd estimate.
<RX14> and this isn't open source yet?
<Papierkorb> -> TechPreview
<RX14> yeah but what exactly does that mean
<Papierkorb> the technology preview will act as "beta" of sorts. Free software, hosted in github code-wise. It's just a label to say "not done yet, things may crash, etc."
<RX14> so you're going to open source it monday or tuesday but in an alpha state
<Papierkorb> Pretty much
<RX14> i find that much more descriptive than "TechPreview"
<FromGitter> <bew> there will be a Papierkorb I/O conference in San Francisco ?
<Papierkorb> But then there's still tons of things to do. With that state though, you'll be able to use most features of Qt (those already bound). The Qt integration into LibEvent can then happen in Crystal code, which is one of the many things not part of the TP
<Papierkorb> bew, nope
<RX14> Papierkorb, so there's a general-purpose C++ bindings generator fit for binding Qt to a high level, and Qt bindings as a shard with some custom code to fill the small gaps?
<FromGitter> <bew> bindgen will be part of that techpreview?
<Papierkorb> bew, Yes
<FromGitter> <bew> nice!
<RX14> what are the implications of Qt not being integrated into LibEvent yet
<Papierkorb> RX14: Yep. I developed both alongside. Will probably spin off the bindgen into its own project before publishing.
<RX14> does it mean IO is going to hang the UI thread or something?
<Papierkorb> RX14: No fibers, the crystal world just "stops" and will only run when called by Qt, e.g., when it sends a signal you're connected to
<RX14> so fibers will segfault or what?
<RX14> does Qt spawn it's own UI thread or use the default thread for it?
<Papierkorb> Fibers just never get run after you start Qts event loop
<Papierkorb> it uses the thread you start it in
<Papierkorb> But it can be integrated with libevent, and that is the correct way that'll have to happen. It's one of the goals for the "usable release"
<RX14> surely if you block on IO in the signal handler you'll get fibers run
<RX14> obviously it won't be very... deterministic but
<Papierkorb> line 60 in the first source file
<RX14> ah thats cool
<Papierkorb> RX14: No, Qt uses its own event loop (by default, can be replaced), which does everything libevent does. It never reaches libevent after that line
<RX14> oh yeah because the main fiber never blocks there will always be something on the scheduler stack
<RX14> so you never get to libevent
<Papierkorb> RX14: Will be unavailable for the next 6hrs or so, we can talk tomorrow though when I'm there. If you have questions, best /query them, so I'll actually get them lul.
<RX14> yeah ok
<RX14> i'll just wait for the source code lol
<RX14> would be nice to know exactly how you plan to integrate the 2 event loops though
<FromGitter> <bew> I'm waiting for that too :P
<FromGitter> <bew> I hope it'll still work one way or another when multi-threading will be a thing in Crystal
<RX14> I still havent asked
<Papierkorb> RX14: though w.r.t challenges, choices etc, I'm planning on documenting tons of it, or if I finally get around starting a blog, write about it there too. Pretty sure many of the solutions can be adapted to other things, or improved otherwise
<RX14> I still havent asked about how possible it would be to implement threads in crystal before we have a n:m scheduler
<FromGitter> <codenoid> hi there, anybody know how to setup Dynamic IP for Crystal HTTP Client, & i run in ubuntu 16.04
<RX14> Papierkorb, really well done high-level Qt bindings that aren't C++ but are compiled and statically typed are something that I think would bring a lot of people to crystal
<FromGitter> <bew> @RX14 what is a n:m scheduler?
<RX14> scheddules m fibers onto n OS threads
<RX14> we currently have a 1:n scheduler
<FromGitter> <bew> oh I see
<RX14> which is many fibers on 1 OS thread
<Papierkorb> RX14: Absolutely, see above for an idea of a showcase program ("small 3D editor") as proof for its viability. I think the language is on to something in the desktop application industry.
<RX14> "small 3D editor"?
<FromGitter> <bew> RX14 you mean: m:1 ?
<FromGitter> <bew> oh no nvm
<RX14> idk
<RX14> you get the idea
<FromGitter> <bew> yep thanks
<RX14> regardless of the way around it is lol
rohitpaulk has quit [Ping timeout: 240 seconds]
relaxbox has joined #crystal-lang
<FromGitter> <codenoid> ok,
rohitpaulk has joined #crystal-lang
fenicks has left #crystal-lang [#crystal-lang]
<watzon> Yeah Papierkorb! Qt is looking good!
<crystal-gh> [crystal] asterite pushed 1 new commit to master:
<crystal-gh> crystal/master 1655935 Ary Borenszweig: Optimize String::Builder#write_byte
snsei has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #4856: Document `flag?` macro method (master...feature/document-macro-flag)
snsei has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#1655935 (master - Optimize String::Builder#write_byte): The build passed.
rohitpaulk has quit [Ping timeout: 246 seconds]
<travis-ci> crystal-lang/crystal#1655935 (master - Optimize String::Builder#write_byte): The build passed.
<crystal-gh> [crystal] RX14 closed pull request #4591: Semantic: specify Void alias type as yiled output restriction (master...fix/crystal/type-alias-restriction-yield)
<crystal-gh> [crystal] RX14 closed pull request #4579: Semantic: report block result mismatch on method instantiate (master...fix/crystal/fix-4543)
<crystal-gh> [crystal] asterite opened pull request #4857: Fix macro method lookup (master...feature/fix-macro-method-lookup)
<travis-ci> crystal-lang/crystal#8ce76a6 (master - Semantic: specify Void alias type as yiled output restriction (#4591)): The build passed.
<crystal-gh> [crystal] RX14 pushed 1 new commit to master:
<travis-ci> crystal-lang/crystal#8ce76a6 (master - Semantic: specify Void alias type as yiled output restriction (#4591)): The build passed.
<crystal-gh> crystal/master 4bec310 Julien Portalier: Use an Enum for Process stdio redirections (#4445)
<travis-ci> crystal-lang/crystal#8ce76a6 (master - Semantic: specify Void alias type as yiled output restriction (#4591)): The build passed.
<FromGitter> <bew> PR are merging! @asterite is back :D ✨ Can't wait the next release with all this stuff
<RX14> Yah, i'm glad @asterite is back
<FromGitter> <bew> finally #4445 is merged 👍
<FromGitter> <fridgerator> Wow !!
<travis-ci> crystal-lang/crystal#7f38887 (master - Semantic: report block result mismatch on method instantiate (#4579)): The build passed.
hightower4 has joined #crystal-lang
snsei has joined #crystal-lang
<travis-ci> crystal-lang/crystal#7f38887 (master - Semantic: report block result mismatch on method instantiate (#4579)): The build passed.
<travis-ci> crystal-lang/crystal#7f38887 (master - Semantic: report block result mismatch on method instantiate (#4579)): The build passed.
snsei has quit [Remote host closed the connection]
<FromGitter> <bew> is there a way to feed an IO with another IO ?
<FromGitter> <bew> both are IO::Memory
<RX14> what do you mean "feed"
<RX14> is IO.copy what you're looking for?
<FromGitter> <bew> oh yes, I missed it, thanks
<watzon> Yay!!!!
<watzon> Finally!!!
relaxbox has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#4bec310 (master - Use an Enum for Process stdio redirections (#4445)): The build passed.
relaxbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#4bec310 (master - Use an Enum for Process stdio redirections (#4445)): The build passed.
<travis-ci> crystal-lang/crystal#4bec310 (master - Use an Enum for Process stdio redirections (#4445)): The build passed.
<FromGitter> <bitmappergit> i re installed linux
<FromGitter> <bitmappergit> had fun getting crystal to work
<FromGitter> <krypton97> I think of getting hackingtosh
<watzon> It’s worth it lol
<FromGitter> <krypton97> Is it??
<watzon> Hackintosh’s are awesome
<FromGitter> <krypton97> Do you have it? I'm afraid that the wifi drivers are not available
<FromGitter> <krypton97> Support*
<watzon> You just need to build one custom
<watzon> And do lots of research
<FromGitter> <krypton97> Got an asus rog
<FromGitter> <krypton97> Better should have bought a mac
<oprypin> pls
<FromGitter> <krypton97> Ease
<FromGitter> <krypton97> Every conference is hosted by a guy with mac
<FromGitter> <krypton97> I remember my c++ teacher was using windows on mac os lol
<FromGitter> <krypton97> Cant forget that one
<RX14> mac is just unix for people who don't know what they're doing :)
<RX14> or maybe lazy would be more accurate
<FromGitter> <bitmappergit> i mean the only mac i would buy is the macbook
<FromGitter> <bitmappergit> or the desktop all in one one
<FromGitter> <bitmappergit> that's cause you can't get anything that runs mac perfectly that comes in that format
<RX14> i'd buy a macbook and then put linux on it, if i had the money
<RX14> but the dell XPS latops are pretty good too
<RX14> so maybe i wouldn't
<FromGitter> <drujensen> For me, my mac will let me do every type of dev possible without having multiple dev systems. iOS, Mac, Windows, Linux, etc.
<FromGitter> <drujensen> dual boot if you need Windows, but I rarely do that
schovi has joined #crystal-lang
<FromGitter> <krypton97> Mac has the best dev support imo
<crystal-gh> [crystal] asterite pushed 2 new commits to master:
<crystal-gh> crystal/master 5362e25 Ary Borenszweig: macro_spec: better descriptions for tests
<crystal-gh> crystal/master 49f7bac Ary Borenszweig: Fix macro method lookup
<schovi> dsada
<crystal-gh> [crystal] asterite pushed 2 new commits to master:
<crystal-gh> crystal/master 34cf351 Ary Borenszweig: flag? macro method: link to compile-time flags docs
<crystal-gh> crystal/master 444e80c Ary Borenszweig: Document `flag?` macro method
<RX14> surely the best dev support is running the same OS as your servers?
<RX14> plenty of windows apps that don't run on mac too
<FromGitter> <krypton97> Like?
schovi has quit [Client Quit]
<RX14> i;d prefer windows at this point since at least you get windows + linux
<FromGitter> <krypton97> I hate winodows
<RX14> which is a bigger cross-section of programs than linux + mac
<FromGitter> <drujensen> @RX14 I can run all three from a mac, so I agree with you completely
<FromGitter> <schovi> Hello. I am trying to run postgres with crystal and found some unconsistency against documentation. Having simple query ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ how to resolev this? []
<RX14> try a Float64
<FromGitter> <drujensen> yeah, looks like a type mismatch
<RX14> I think mac is still too opaque to me
<RX14> not as bad as windows but still
undy1ng has joined #crystal-lang
<FromGitter> <drujensen> I live in the terminal most of the time
<FromGitter> <drujensen> vim
<FromGitter> <schovi> Float64, Int64, Int32 Nothing works
<RX14> i don't think i'd mind mac but i've been using a highly-customized linux wm as my only desktop OS since i was 14
<RX14> so i'd find it hard to change at this point
<FromGitter> <drujensen> haha, I used redhat and ubuntu for 10 years as my only dev platform
<FromGitter> <drujensen> moved to the mac and never went back.
<RX14> well i run i3 with customised keybinds so it's probably harder for me
<FromGitter> <drujensen> plus i wanted to build iOS apps so didn’t really have a choice. :-)
<RX14> as in, I use capslock + shift + q to close programs
<FromGitter> <drujensen> gotcha, yup.
<RX14> i'd just virtualise osx
<FromGitter> <drujensen> hardest thing was getting used to keyboard changes
<FromGitter> <krypton97> I couldn't find a free bugs linux distro
<RX14> @schovi looks like it's returning this class:
<RX14> well you're never going to find any OS with no bugs
<RX14> I find working around the bugs fun
<FromGitter> <krypton97> No, it's because my laptop is to new
<RX14> I don't get too many issues since I use a desktop
<FromGitter> <krypton97> I had to edit the grub to install it and took me like 2-3 days to find the right options
<RX14> which is pretty much standard desktop intel hardware
<RX14> the easiest stuff to get working with linux
<RX14> ah yeah grub, it took me a good few years to stop hating grub
<FromGitter> <drujensen> can you run MacOS in a VM now?
<RX14> and now i just dislike it, i mostly understand it though
<FromGitter> <bitmappergit> i really like everything about solus except for eopkg
<RX14> @drujensen it was possible in vbox last time i tried
<FromGitter> <krypton97> I remember I managed to install ubuntu without any issue on my job's desktop
<FromGitter> <krypton97> I'm using solus hehe
<FromGitter> <krypton97> I agree, I miss apt
<RX14> i would never miss apt
<FromGitter> <bitmappergit> i miss pacman
<FromGitter> <drujensen> well, that is something pretty new. Apple used to lock down the os so it only ran on their hardware
<FromGitter> <bitmappergit> and the aur
<RX14> pacman is probably the best package manager for linux i've used
<FromGitter> <bitmappergit> agreed
<FromGitter> <krypton97> Mac has brew, it's awesome
<FromGitter> <bitmappergit> along with pacaur
<RX14> apk is the fastest, apt/spkg is the slowest package manager
<RX14> pacman is still pretty fast and clean but it has lots of features
<RX14> it's a good balance between bloat and speed
<FromGitter> <krypton97> Pacman belongs to arch, right?
<RX14> yes
<FromGitter> <bitmappergit> yeah
<FromGitter> <bitmappergit> i moved from arch to solus
<FromGitter> <bitmappergit> was going to move to liri
<FromGitter> <bitmappergit> liri is like arch chrome os
<FromGitter> <krypton97> Might change my dostr
<FromGitter> <krypton97> Distro*
<FromGitter> <schovi> @RX14 ha!
<FromGitter> <bitmappergit> liri is really really beta tho
<FromGitter> <krypton97> Or go insane and put that hsckingtosh
<FromGitter> <schovi> Not confusing at all !
<FromGitter> <schovi> :)
<FromGitter> <bitmappergit> that's why i used solus
<RX14> I do weird custom things to my linux so I stick to arch
<FromGitter> <bitmappergit> yeah me to
<FromGitter> <bitmappergit> i wanted to stop
<FromGitter> <bitmappergit> it was screwing up my install
<RX14> i do weird things, get them stable, and leave them
<FromGitter> <bitmappergit> crystal was not fun to install on solus tho
<RX14> my arch install has been pretty rock solid for 3+ years
<RX14> i'm probably going to reinstall soon though
<FromGitter> <krypton97> Ikr right
<RX14> well, 2 installs actually
<FromGitter> <krypton97> I found nim, but no crystal
<RX14> i'm going to keep them in parallel in different subvolumes of 1 btrfs
<FromGitter> <bitmappergit> did you get it running anyway @krypton97
<FromGitter> <bitmappergit> i did
<FromGitter> <krypton97> Yep, got the source files and set some global variables
<FromGitter> <bitmappergit> i didn't compile
<FromGitter> <bitmappergit> just grabbed the binary release
<FromGitter> <bitmappergit> got swift running too
<travis-ci> crystal-lang/crystal#5362e25 (master - macro_spec: better descriptions for tests): The build passed.
<FromGitter> <krypton97> It's working, that's all it matters
<FromGitter> <bitmappergit> yeah
<FromGitter> <bitmappergit> wait
<FromGitter> <krypton97> Got the android sdk too, don't need morr
<FromGitter> <bitmappergit> how did you compile it if you need crystal to compile it
<FromGitter> <krypton97> E
<FromGitter> <krypton97> I'm running the compiler
<travis-ci> crystal-lang/crystal#5362e25 (master - macro_spec: better descriptions for tests): The build passed.
<travis-ci> crystal-lang/crystal#5362e25 (master - macro_spec: better descriptions for tests): The build passed.
<FromGitter> <bew> RX14 I'm currious, do you have your WM configs and stuff on github?
<FromGitter> <bew> nvm I've found 'em
<watzon> Lol I love how active the crystal community is. I leave for 15 minutes and I’ve missed like 50+ messages
<travis-ci> crystal-lang/crystal#34cf351 (master - flag? macro method: link to compile-time flags docs): The build passed.
<FromGitter> <krypton97> I like that people here are nice, not like go community
<FromGitter> <krypton97> Go reddit banned a framework
<FromGitter> <krypton97> Whenever someone talk about it, it gets insta downvotes
<FromGitter> <krypton97> Bunch of kids there lel
<watzon> That’s Reddit for ya
<watzon> I feel like Go was over hyped and under delivered, but that’s just me
<FromGitter> <krypton97> If go wasn't backed by google it would have been like other langs
<travis-ci> crystal-lang/crystal#34cf351 (master - flag? macro method: link to compile-time flags docs): The build passed.
<travis-ci> crystal-lang/crystal#34cf351 (master - flag? macro method: link to compile-time flags docs): The build passed.
relaxbox has quit [Ping timeout: 248 seconds]
fenicks has joined #crystal-lang
relaxbox has joined #crystal-lang
<FromGitter> <bitmappergit> i'm getting this
<FromGitter> <bitmappergit> Syntax error in expecting identifier 'end', not 'EOF' ⏎ ⏎ end ⏎ ^ []
<FromGitter> <bitmappergit> with valid code
<watzon> bitmappergit: Please show the code
<watzon> Use
<FromGitter> <bitmappergit>
<FromGitter> <krypton97> Add one more en
<FromGitter> <krypton97> D
<FromGitter> <bew> look line 10
<FromGitter> <bew> `if if`
<watzon> Yup
<watzon> That's the issue
<FromGitter> <krypton97> Nvm
<FromGitter> <bitmappergit> ahh
<FromGitter> <krypton97> There's alson an double if
<FromGitter> <bitmappergit> i'm an idiot
<FromGitter> <krypton97> That's a nested if o guess
<FromGitter> <krypton97> That's why you missed the end
<watzon> Easy mistake
<FromGitter> <bew> Not sure what to think about, but he has a valid point
<watzon> I don't want to agree, because I love Crystal
<watzon> But he has a point
<FromGitter> <bew> ahah I'm like you
<FromGitter> <krypton97> Isn't crystal scalable?
<watzon> The problem is that the compiler eats memory
<FromGitter> <krypton97> C#, jvm eats more
<FromGitter> <krypton97> What would be the solution in this case
<FromGitter> <krypton97> ?
<FromGitter> <krypton97> Rewritting the compiler?
<watzon> Some larger programs simply wont compile because the computer will run out of memory
<watzon> The compiler has to be made more efficient
<FromGitter> <krypton97> Loool, that's a big issue
<FromGitter> <krypton97> Why did they have to build it on top of LLVM?
<watzon> It's a lot quicker to do that than to build their own assembler
<watzon> And LLVM works well enough
<dom96> I don't think LLVM is the issue in this case.
<watzon> No, I don't believe so
<FromGitter> <krypton97> I didn't mean that
<watzon> Off topic: I'm watching Linus Tech Tips' new video about the Razer Toaster. I really want to hang out with that guy lol
<FromGitter> <krypton97> Those subway sandwiches are not worth it jeez
<FromGitter> <krypton97> Also, it seems that crystal 1.0 won't happen too soom
<watzon> More than likely, no
<watzon> There's a lot to do
relaxbox has quit [Ping timeout: 240 seconds]
<FromGitter> <bitmappergit> haha i want to go to british columbia to meet linus
<FromGitter> <bitmappergit> but i'm in new brunswick
<FromGitter> <krypton97> Ask him about java x)
<FromGitter> <bitmappergit> somebody told me that clojure is the language everyone should learn
<FromGitter> <bitmappergit> and that everyone was going to be using it soon
<watzon> Someone will always say that about every language
<FromGitter> <bew> @bitmappergit it's because they didn't try Crystal :P
<watzon> Clojure is great, but not for every purpose and it's built on Java which I have a problem with
<FromGitter> <bitmappergit> i'm also testing out swift
<FromGitter> <bitmappergit> but apple
<watzon> That's worse :(
<FromGitter> <krypton97> The only problem I have with java is Oracle
<FromGitter> <bitmappergit> why
<FromGitter> <krypton97> And msybe that extreme oop and vm needed
<FromGitter> <krypton97> Oracle is
<FromGitter> <krypton97> That's offtopic
<watzon> I hate how clunky Java is, and how slow the startup time is. Swift has the Apple issue and it's just not all that great overall
<FromGitter> <bitmappergit> no i meant why is swift wors
<FromGitter> <bitmappergit> nvm
<FromGitter> <krypton97> Swift looks like es6 to me
<FromGitter> <bitmappergit> hey at least it's not scratch
<FromGitter> <krypton97> (Javascript )
<watzon> Yeah, but Brainfuck isn't scratch either
<RX14> @bew those configs are *really* sout of date
<watzon> ++++++++[>++++[>++>+++>+++>+<<<<-]>+>->+>>+[<]<-]>>.>
<watzon> >---.+++++++..+++.>.<<-.>.+++.------.--------.>+.>++.
<FromGitter> <bitmappergit> haha i ported brainfuck to plan9
<FromGitter> <bitmappergit> it wasn't fun
<FromGitter> <bew> RX14 Feb 2016, didn't saw that x)
<RX14> yeah lol
<FromGitter> <bew> will you update them? or do you have a new repo?
<watzon> We should start adding Crystal samples to
hightower4 has joined #crystal-lang
<watzon> Added the first one :)
hightower4 has quit [Ping timeout: 248 seconds]
_whitelogger has joined #crystal-lang
<watzon> I'm confused as to why there's a `BigRational` if there's no `Rational`
<crystal-gh> [crystal] asterite pushed 2 new commits to master:
<crystal-gh> crystal/master e811cf9 Ary Borenszweig: ci: run std and compiler specs separately
<crystal-gh> crystal/master 9ae0c83 Ary Borenszweig: Improve JSON and YAML exception locations
<watzon> Uh oh
<watzon> I'm trying to convert a simple Ruby script to Crystal and I'm getting one of those "you found a bug in the compiler" errors
<RX14> watzon, please file a bug report
<watzon> Will do, do you see anything super wrong with the code?
<watzon> I just started converting, so I'm not 100% sure all the methods exist
<watzon> Looks like `Int.between` doesn't exist
greenbigfrog has joined #crystal-lang
<FromGitter> <johnjansen> either way its an Int8 ... not a UInt8 so it cant range to 255 can it?
<watzon> That's true haha
<watzon> I guess that check is redundant now
<FromGitter> <johnjansen> and it will always be in range it its a UInt8
<FromGitter> <johnjansen> so you dont need to test it
<watzon> Wait, I forgot that values aren't automatically casted if possible though
<watzon> So I do need to make those Int32's for usability
<watzon> Is there an existing method with similar functionality to that of Ruby's `Comparable.between?`
<FromGitter> <bew> you can `a <= b <= c`
<FromGitter> <johnjansen> i feel like we have had this exact conversation before @watzon
<watzon> Have we? Lol
<watzon> It's possible
<travis-ci> crystal-lang/crystal#e811cf9 (master - ci: run std and compiler specs separately): The build passed.
<FromGitter> <johnjansen> like including the same code and the same ... but i need it to be an Int32 for convenience conversation ... which BTW i slightly disagree with
<travis-ci> crystal-lang/crystal#e811cf9 (master - ci: run std and compiler specs separately): The build passed.
<watzon> Hmm. I don't remember ever needing something like this before
<FromGitter> <johnjansen> given you will either have to clamp ( the values to 255 and silently limit the range, or alternatively raise when the value is out of range ... effectively forcing them to trap and test anyway (removing any convenience you gave them)
<FromGitter> <johnjansen> hmmm maybe it wasnt you ... but someone had RGB values and precisely the same issue ... hmmm
havenwood has left #crystal-lang ["Bye!"]
<watzon> Ahh I do think I remember a similar conversation now that you bring up clamp
<watzon> But it's not really necessary for this example. I'm just doing a small code sample using Crystal to create a "Bitmap" which is really just a multi-dimensional array of pixels
<FromGitter> <johnjansen> just use UInt8 and let the type system do its job
<FromGitter> <johnjansen> it accurately represents the allowable data after all
<watzon> That's true
<watzon> I wish the compiler could perform some automatic casting though
<FromGitter> <johnjansen> how
<FromGitter> <johnjansen> you are just moving the problem
<FromGitter> <johnjansen> i pose you this question; ⏎ if you use Int32 (as you propose), and i give you 400, 600, 800 as values ... what do you do?
<watzon> It would be nice if you could say `def myfunc(num : Int8) ...` and then call it with `myfunc(12)` rather than `myfunc(12_i8)`
<watzon> Throw an ArgumentException
<FromGitter> <johnjansen> so you force them to test their values and / or trap anyway right?
<watzon> Yeah
<FromGitter> <bew> @watzon this is an open issue: #2995
<FromGitter> <johnjansen> so, wouldnt it be easier for them to just make them the correct type and not do those things?
<watzon> Oh good bew. Thanks
<FromGitter> <johnjansen> im not sure about that ticket personally
<watzon> Yeah, but I agree with oprypin in that issue. I don't think number literals should be bound to Int32 and Float64
<FromGitter> <johnjansen> it also doesnt help your problem
<FromGitter> <johnjansen> maybe ... its complicated
<FromGitter> <johnjansen> so one thing you can do right now, is clamp the values into range, discarding higher or lower values, and dont fail
<watzon> Why not? I feel like it would work in my case. I could then say that the method take an Int8 and if they try and put in a value bigger than 255 it should thow an exception, right?
<watzon> Here's what I'm doing now
<watzon> Seems to work
<watzon> But I haven't actually tested the program yet, it just compiles as is
<FromGitter> <johnjansen> what you should do is write the code to consume your method in both cases, and see how it is to work with
<watzon> What do you mean?
<oprypin> watzon, it's not a good idea to put int32 where you expect int
<oprypin> 8
<FromGitter> <johnjansen>
<oprypin> at the very least make it Int
<watzon> Ahh I gotcha
<FromGitter> <johnjansen> now write some code to handle issues calling both ways
<FromGitter> <johnjansen> see if Int32 is actually more convenient
<FromGitter> <johnjansen> personally i think its more of a pain in the ass
<FromGitter> <johnjansen> in this case
<FromGitter> <johnjansen> also internally you need to cast it to UInt8 really ...
<FromGitter> <johnjansen> @red, @green & @blue should be UInt8 internally whatever you do
<watzon> Ok, well this is what I have now. Seems to work alright
<watzon> I still think #2995 has merit though
<FromGitter> <johnjansen> on a different front, do you really support negative sizes on your `Pixmap`
<watzon> I'm still working on it haha. This was Ruby code originally and not written by me
<watzon> I guess it would make more sense to use a UInt32 though, huh?
<FromGitter> <johnjansen> ahh yes, the type system in crystal will allow you to delete alot of parameter validation code
<watzon> Gotta love types
<FromGitter> <johnjansen> do you really need something that can be 4294967295 pixels wide / high?
<FromGitter> <johnjansen> seems a little large to me
<watzon> Probably also a good point, but you never know. Maybe they're shooting in 16K
<watzon> Lol