ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<oprypin> ah yes, search for `Extern`. i also define enums outside of lib
hightower2 has quit [Ping timeout: 260 seconds]
<FromGitter> <bew> I also do enum outside the libs :D
sagax has quit [Quit: Konversation terminated!]
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
greengriminal has joined #crystal-lang
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
snsei_ has quit [Ping timeout: 258 seconds]
snsei has quit [Remote host closed the connection]
sp4rrow has joined #crystal-lang
snsei has joined #crystal-lang
pwned has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
pwned has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
sz0 has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
pwned has joined #crystal-lang
_whitelogger has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
<FromGitter> <codenoid> sorry about the readme,
hightower2 has joined #crystal-lang
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 260 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <sdogruyol> @Groogy i really liked
mark_66 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
snsei_ has quit [Remote host closed the connection]
<FromGitter> <bararchy> @sdogruyol For cryload, do you preffer PR's or issues ? :)
rohitpaulk has joined #crystal-lang
<FromGitter> <sdogruyol> @bararchy PRs ofc :D
<FromGitter> <bararchy> Get ready then XD
<FromGitter> <sdogruyol> lol :D
<FromGitter> <sdogruyol> check my comment
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> BTW have a nice week everyone
<FromGitter> <bew> thanks, so do you!
<FromGitter> <sdogruyol> Thank you @bew , how are you?
rohitpaulk has joined #crystal-lang
fenicks has quit [Ping timeout: 258 seconds]
<FromGitter> <bew> its ok, had fun with crystal yesterday, now I need to work today (python :/), then go back to crystal :D
<FromGitter> <crisward> I'm quite please to get my first publish shard out -
<FromGitter> <sdogruyol> @crisward congrats 🎉 Thanks for using and improving Kemal 🙏
<FromGitter> <crisward> I have an email sending library with mailgun / sendgrid support in the pipeline too.
<FromGitter> <crisward> @sdogruyol it's the least I can do.
<FromGitter> <crisward> That's my task for next weekend if I get chance.
<FromGitter> <sdogruyol> wow awesome
<FromGitter> <sdogruyol> I'll announce this shard from Kemal account :)
sz0 has joined #crystal-lang
fenicks has joined #crystal-lang
<FromGitter> <suvendusamanta> One quick question : Can I create a class inherited from multiple classes (like in C++) or abstract classes(interface)? What is the syntax? I tried with ⏎ ` ⏎ class C < A, B ⏎ end ⏎ ` ... []
<hightower2> suvendusamanta: you can't use multiple inheritance (other than through a chain, like A inherits from B, B inherits from C, C from D and so on). But you can use 'modules' and include them in your class to achieve something similar
<hightower2> class Class_A < Class_B; include Module_C; include Module_D; end
<FromGitter> <sdogruyol> please prefer composition over inheritance and you can do that by using modules @suvendusamanta
<FromGitter> <suvendusamanta> Ok, thanks @FromIRC
<FromGitter> <codenoid> 😆
<FromGitter> <crisward> @sdogruyol Thanks! Also thanks for including Duo in your presentation as Rubyconf, you seem to be doing an excellent job at encourage developers to try crystal.
<FromGitter> <sdogruyol> I'm trying my best @crisward :) Thanks for using Crystal and Kemal
<FromGitter> <sdogruyol> hope to see that list grow
<FromGitter> <suvendusamanta> @sdogruyol sure, I will do. Thanks
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
Raimondii has joined #crystal-lang
snsei has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <bararchy> @sdogruyol PR ready for you ;)
<FromGitter> <sdogruyol> @bararchy thanks, i've just seen it
<FromGitter> <sdogruyol> How about we start adding some specs :P
<FromGitter> <bararchy> specs ?!?!!? what are those for ? XD
<FromGitter> <sdogruyol> It's a shame that we don't have any specs for cryload :D
<FromGitter> <sdogruyol> hahaha
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <bararchy> Good idea
<FromGitter> <bararchy> I'll open an issue and try and follow on with a pr
<FromGitter> <sdogruyol> it's actually my first real Crystal project, even before Kemal :D
<FromGitter> <sdogruyol> thank you @bararchy
<FromGitter> <bararchy> Don't mention it :)
rohitpaulk has joined #crystal-lang
Groogy has quit [Disconnected by services]
Groogy_ is now known as Groogy
<Groogy> @sdogruyol thanks!
Groogy2 has joined #crystal-lang
<Groogy> will hopefully have a better usage example though when I have sat down and used it a bit myself in a Crystal environment and not just c++
<FromGitter> <sdogruyol> you project reminded me of Elixir guard cases
<FromGitter> <sdogruyol> ```code paste, see link``` []
<Groogy> well it's based on the same principles actually
<FromGitter> <sdogruyol> indeed
<Groogy> I based mine on D though
<FromGitter> <sdogruyol> it really makes the code leaner
<Groogy> and C++17 is also adding contracts as included in the language syntax itself
<FromGitter> <sdogruyol> did you know that we have UFC implementation for Crystal :P
<Groogy> what's UFC? don't recognize that acronym
<FromGitter> <sdogruyol> uniformed function call from D
<FromGitter> <sdogruyol>
<Groogy> oiooh
<Groogy> that's super cool
<Groogy> yeah I remember that being weird to learn when reading D in that length(Array arr) could also be called as arr.length
<FromGitter> <sdogruyol> yeah, that really opened my mind at first 😄
<crystal-gh> [crystal] MakeNowJust opened pull request #4697: Format: fix to format NamedTuple with trailing comma (master...fix/crystal-format/4685-named-tuple-trailing-comma)
<Yxhuvud> sdogroyul: hmm, adding information about percentiles and stddev to that would probably be pretty straightforward and useful.
<Groogy> Yxhuvud, swedish? :P (with that name so)
<Yxhuvud> groogy: yes. There are a few of us here.
<FromGitter> <sdogruyol> @yxhuvud you mean for benchmarks?
<Yxhuvud> yeah
<FromGitter> <sdogruyol> that'd be better for sure, however i suck at creating fancy charts and graphs :(
<FromGitter> <sdogruyol> I definitely need some help for data visualization
<Groogy> I mean you can create it kind of nice even in text format?
<Groogy> otherwise I think GTK and so on have tons of tools for those kind of things
<Groogy> in their API
<Groogy> ops wrong link
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> like i said I'm a noob about those
<Groogy> there's the image I was gonna link
<Groogy> you can still structure things in a text/log format so it looks decent
<Yxhuvud> hmm, if you use I think you'd get that more or less for free as it works with the graph tool at Or at the very least you can tell me what doesn't work and I'd fix it :)
<FromGitter> <bararchy> what is this cow on the sublime screen ?
<Yxhuvud> (that = graphing)
<Groogy> no it's an inside jokes with fans of the game
<Groogy> we leaked an image of a new feature in the next patch
<Groogy> which was that cow
<FromGitter> <bararchy> Oh hahah
<FromGitter> <bararchy> cool
<Groogy> and it spawned tons of pun threads
<Groogy> on the forum
<FromGitter> <sdogruyol> cool thanks @Groogy
<FromGitter> <bararchy> Groogy what is this game ?
<Groogy> Europa Universalis IV
<crystal-gh> [crystal] MakeNowJust opened pull request #4698: Format: raise an error if unclosed paren is found on finish (master...fix/crystal-format/error-if-paren-count-1-more)
<FromGitter> <bararchy> looks like civ from file names
<FromGitter> <bararchy> Oh, makes sense hahah
<FromGitter> <bew> very nice cow
<Groogy> we're cooler than Civ (•_•) ( •_•)>⌐■-■ (⌐■_■)
<FromGitter> <sdogruyol> @Groogy my twin brother is crazy with EU series
<Groogy> one of our games is 6 years old now I think and we are still patching it for free
<FromGitter> <sdogruyol> he's a real hardcore strategy game player
<Groogy> Oh cool ^^
<Groogy> yeah we have quite a large Turkish market actually suprsingly enough
<FromGitter> <sdogruyol> however I prefer Civ 5 :P
<Groogy> guy who made Civ 5 works for us now ;D
<FromGitter> <sdogruyol> @Groogy yeah Turkish players really like RTS e.g
<FromGitter> <bararchy> Groogy, did you ever played banished ?
<Groogy> No but I own it and it is on my "If I ever get time I should play this"
<FromGitter> <bararchy> XD
<Groogy> you know which means "never"
<Yxhuvud> I wonder if the turks like EUIV due to ottomans being OP ;)
<Groogy> Ottomans aren't as OP as they used to though
<Groogy> I remember back in the days when they got the 3x manpower if fighting Christians bonus
<FromGitter> <sdogruyol> @Groogy haha
<FromGitter> <sdogruyol> you know what
<Groogy> Because Suleiman the Magnificent was a freakin badass as motivation I think
<FromGitter> <sdogruyol> for the last 10 years we got some Ottoman movement, remembrance going strong
<FromGitter> <sdogruyol> that can explain why Turks like EU that much
<FromGitter> <sdogruyol> Suleiman and Fatih the conqueror
<FromGitter> <sdogruyol> the 2 greatest Ottoman sultans
<FromGitter> <sdogruyol> we have like too many people named "Fatih" :P
<Groogy> lol
<Groogy> Wait you have like a neo-ottoman movement?
<FromGitter> <sdogruyol> not like that
<Groogy> yeah thought that would have been weird
<FromGitter> <sdogruyol> It's more like people are remembering how awesome Ottoman Empire was :D
<FromGitter> <sdogruyol> realizing the achievements e.g
<FromGitter> <sdogruyol> because most of the people werent aware of our history
<FromGitter> <sdogruyol> which was really weird from the start lol
<Groogy> ah
<FromGitter> <sdogruyol> with the Turkish Republic founded in 1923, It's like we erase all the history from Ottoman era
<Groogy> well the entire middle east has super interesting history during this time period and earlier, my favorite empire though to be honest are the Persian ones
<Groogy> especially the one where the Persian emperor says "Fuck you" to Ghengis Khan which prompts Ghengis to just slaughter everything to the west of the Tarim basin
<Groogy> worlds biggest "whoops"
<FromGitter> <sdogruyol> rofl
<Groogy> In asia, killing a messenger was a really strong taboo
<FromGitter> <sdogruyol> didn't know that but i agree on "Middle easy having a very interesting history" part
<FromGitter> <sdogruyol> It's been always the most busiest part of the world
<Groogy> the Persian emperor did that, Ghengis Khan sends another and like "I am giving you an oppertunity to apologise", killed that one as well
<Groogy> "welp I guess the world gotta burn now"
<FromGitter> <sdogruyol> :D
<Groogy> and that's how modern state Russia got its first seeds planted ^^
<FromGitter> <sdogruyol> cool
<Groogy> and I think the Seljuk Turks establishing themselves in Anatolia is kind of related to that as well
<Groogy> since they were "safe" there
<FromGitter> <sdogruyol> yeah
<Groogy> anyway sorry for offtopic, I just love history :P
<FromGitter> <sdogruyol> we have some TV series which focuses on the first times and founding of Ottoman Empire from Seljuk Turks
<Groogy> oh that's cool do they exist like translated?
<Groogy> would love to watch
<FromGitter> <sdogruyol> yeah I also kind of love it though I'm not that knowledgable :P
<FromGitter> <sdogruyol> let me check it
<FromGitter> <sdogruyol> Ottoman tv series are really popular but they contain a lot of filler too :D
<FromGitter> <sdogruyol> holy shit
<FromGitter> <sdogruyol> I didn't know that but It's actually on Netflix :O
<Groogy> ah not available in my country :(
<FromGitter> <MakeNowJust> @bew Sorry, I missed your mention. See here (, it means parsing `foo.%(1)` uses lexer hack. And I followed it.
<FromGitter> <sdogruyol> hey @MakeNowJust thanks again for great formatter PRs :P
<FromGitter> <sdogruyol> ありがとうございます。がんばってください!
<Groogy> huh if I am reading this right you can do .% or am I reading it wrong?
<oprypin> Groogy, ?
<Groogy> no just reading the code that makenowjust linked
<RX14> Groogy, all operators can be used in the normal method calling style
<RX14> 1.+(2)
<RX14> same with %
<Groogy> oooh it's the modulus operator
<Groogy> duh for some reason I thought it was something different and special
rohitpaulk has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
greengriminal has joined #crystal-lang
<FromGitter> <sdogruyol> hey everyone what do you think of something like this for Kemal
<RX14> @sdogruyol you should still keep the get/post dsl but inside classes
<FromGitter> <sdogruyol> you mean like `Kemal.get`?
<RX14> i think so
<FromGitter> <sdogruyol> well, instead of having that
<RX14> this is an entirely new DSL to kemal
<FromGitter> <sdogruyol> It'd be better to have an `Kemal::Application` instance and calling `app.get`
<FromGitter> <sdogruyol> yeah
<RX14> it doesn't really fit
<FromGitter> <sdogruyol> that's more close express
<RX14> having a router inside kemal feels wrong
<FromGitter> <sdogruyol> why?
<RX14> it should keep the same philosophy of having the paths and methods with the code that handles it
<RX14> not seperating that into a router
<RX14> i even prefer the router way but having both inside kemal is wrong
<RX14> it seems like just shoehorning a new framework inside kemal
<RX14> instead of taking the same DSL you already have and placing it inside classes
<FromGitter> <sdogruyol> I think i'm not following you
<FromGitter> <sdogruyol> can you give an example?
<RX14> of what?
<FromGitter> <sdogruyol> `it should keep the same philosophy of having the paths and methods with the code that handles it`
<RX14> get "/" do/end
<RX14> thats how you use kamel
<RX14> suddently now thats gone
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <sdogruyol> oh i get your opint
<RX14> and you have a router instance which seperates the routing from the logic
<FromGitter> <sdogruyol> however this pr doesn't break that
<RX14> which is not how kemal does things
<FromGitter> <sdogruyol> you can use the global dsl or the new action dsl
<FromGitter> <sdogruyol> however this is still experimental
<RX14> it doesn't break it but it adds a new way of doing things
<RX14> that should be in a new framework
<RX14> you should adapt the same DSL for classes
<RX14> allow classes to include Kemal::Controller and define routes inside the class
<RX14> then allow mounting that class on a path in kemal
<hightower2> Words of wisdom
<FromGitter> <sdogruyol> yeah, that's why I'm not comfortable with this
<RX14> that fits much better with how sinatra and kemal was designed
<RX14> thats how sinatra works
<RX14> kemal seems to be ignoring it's core ideas
<FromGitter> <sdogruyol> ``````
<FromGitter> <sdogruyol> which is the modular apps
<RX14> but you now have a special router
<RX14> ahave you looked up how sinatra does it?
<FromGitter> <sdogruyol> I did, however i don't remember the explicit details atm
<RX14> you still use get "/" do/end inside the class
<RX14> instead of having methods and a router outside the class
<RX14> which means you still keep the same way of defining routes
<RX14> this PR doesn't do that
<FromGitter> <sdogruyol> BTW reading Sinatra's source is hard. Lots of metaprogramming magic going on
<RX14> reading the docs isn't
<FromGitter> <sdogruyol> @RX14 i'm aware that this PR doesnt do that :D
<RX14> sure, but I think it's a bad idea
<RX14> if people want a seperate router with *all* their routes in and to have rails-style methods on classes they can use one of the many frameworks that already do that
<FromGitter> <sdogruyol> let's see how this goes :) I'm still hesitant to say it's a bad idea
<RX14> sinatra doesn't do the same thing everyone else does
<FromGitter> <sdogruyol> correct
<RX14> and neither does kemal
<RX14> and i think that you should have modular applications be the same as sinatra not copying rails
<FromGitter> <sdogruyol> yeah, that's a very old wish of mine to have modular apps in Kemal :D
<RX14> well i asked for it ages ago and got the impression you didn't want it
<RX14> i must have been mistaken
<FromGitter> <sdogruyol> thanks for your great feedback @RX14
<FromGitter> <sdogruyol> oh, did you?
<RX14> the entire reason i've never used kemal is because it doesn't have the modular style
<FromGitter> <sdogruyol> Probably I wasn't clear enough that I wanted that :D
<FromGitter> <sdogruyol> It's good to know :D
<FromGitter> <sdogruyol> the first thing is that I need to decouple the global router and config
<RX14> and i won't use kemal if it adopts that modular style because then it's no different to kemalyst/amber
<FromGitter> <sdogruyol> need to sit down and work on that :D
<FromGitter> <sdogruyol> I like how Amber is going
<FromGitter> <sdogruyol> they take some good ideas from others
<RX14> i tend to dislike any web framework which needs a cli
<RX14> it's a sign that they decided they'd give up and template the boilerplate instead of trying to remove it
<FromGitter> <sdogruyol> well, people like generators i think
<RX14> they're used to them,
<RX14> but i doubt they like them
<FromGitter> <sdogruyol> that's probably the most common reason why Rails is so popular
<FromGitter> <sdogruyol> It's like having a setup wizard lol
<RX14> if there was never a reason for generators in the first place then why would people use them
<RX14> you shouldn't need a setup wizard, you should just add the thing to shards, require it, and ideally get started in 5 lines of code
<FromGitter> <straight-shoota> Hey there =)
<FromGitter> <sdogruyol> well, not everything is so simple to setup :P
<FromGitter> <bew> Hey ;)
<RX14> plenty of web frameworks are that simple to set up
<RX14> and i don't see a reason why crystal's ones shouldn't be too
<FromGitter> <sdogruyol> yeah, but don't really care about those
<FromGitter> <sdogruyol> well, I'd also like to change that too :D
<RX14> apart from if you design it by looking at rails
<RX14> which is a really bad web framework in a lot of ways
<FromGitter> <sdogruyol> but still they're just coming to find the next Rails
<FromGitter> <sdogruyol> ....
<RX14> we decided to change and tweak and move away from ruby for a reason
<RX14> because we had more thing to improve on ruby than just adding static typing
<FromGitter> <sdogruyol> yep
<RX14> i think we should be the same with the web frameworks
<RX14> and currently all I see is rails-style bloat
<RX14> apart from kemal and a few much lesser-used libraries
<FromGitter> <sdogruyol> well node.js did that well
<FromGitter> <sdogruyol> they started with express and everyone used express
<FromGitter> <sdogruyol> It's really simple and modular
<FromGitter> <sdogruyol> they tend to dislike anything big and monolithic
<FromGitter> <sdogruyol> not sure why
<RX14> you can have amber being big and monolithic
<RX14> and still have the starting point fit in 5 lines
<RX14> instead of having all this config jazz which should be optional
<RX14> there are sensible defaults for almost all web server config except for DB connections
<RX14> and even that should be optional if you don't use the DB
<FromGitter> <tarvit> @sdogruyol `the first thing is that I need to decouple the global router and config` ⏎ I agree this should be next step. Having global objects cause a lot of problems for using/maintaining/testing the framework
<FromGitter> <tarvit> In my current PR I added only some decoration layer, which allows simplifying of organization code only. Without changing core approach for now
<FromGitter> <tarvit> But moving with small steps is a correct way to understand more clear way of framework evolution. I think so
<RX14> the first step should be to remove global state, not to introduce an entirely new interface... based on global state
<FromGitter> <straight-shoota> I agree with RX14 that these Action classes would make Kemal to heavy weight. Just wrote a comment on the PR ;)
<FromGitter> <tarvit> @FromIRC hm. Maybe you are right
<FromGitter> <sdogruyol> i agree with @straight-shoota
<FromGitter> <tarvit> @sdogruyol so you think that adding Application level DSL is not the correct step for now? Removing of global state is the only priority for now?
<FromGitter> <straight-shoota> @tarvit Your PR is not translating Kemals DSL to application layer but rather introducing an indirection through routing and action classes
<Groogy> just as a 3rd party perspective seeing how you describe the issue, this sounds way more like something to be it's own project that builds ontop of kemal?
<FromGitter> <tarvit> @straight-shoota not only indirection but separation as well :)
<oprypin> Groogy, i think RX14 is suggesting the opposite, because if a project is fundamentally made with global state, perhaps adding modularity on top of that is not the best idea
<FromGitter> <tarvit> Groogy, I thought about that. This feature can be easily added via 3rd patry shard
<RX14> you can't build something with local state on top of kemal with global state
<RX14> you have to fix kemal
<FromGitter> <tarvit> > **<RX14>** you have to fix kemal ⏎ ⏎ Sure
<FromGitter> <tarvit> It will be the best way. I just wanted to achieve some modularity before we get the real non-global implementation
<FromGitter> <tarvit> And maybe that's not correct to try to get it right now without changes in Kemal core
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> like i said, we need to decouple the router and config :)
<FromGitter> <tarvit> sounds good
<FromGitter> <tarvit> @sdogruyol what should I do with the PR ? I can remove `Action` and leave only non-global DSL and ability to define routes inside of `Kema::Application` classes
<FromGitter> <sdogruyol> I pinged you from Kemal gitter channel
snsei has joined #crystal-lang
<oprypin> nice indeed
<FromGitter> <sdogruyol> I'm really surprised that you got an .exe working with CrSFML @oprypin
<oprypin> bararchy, i dont wanna bring too much attention to that blog post on github with such a plain text link. it's already linked in my post above
<FromGitter> <bararchy> Deleted, anyway, nice !
<FromGitter> <bararchy> Also, why wont you want to bring attention to it ?
<FromGitter> <sdogruyol> guess it's still not that mature
<oprypin> no idea lol
<FromGitter> <sdogruyol> :D
<FromGitter> <bararchy> XD
<oprypin> well yeah, yesterday i saw someone post it on /r/programming and it got bad comments
<oprypin> sdogruyol, it's just linking a normal C library, you know? and no standard library needed because sfml provides a lot
<FromGitter> <bararchy> woot ? why on earth would it get bad comments' I read it and it's cool
<oprypin> but i see the point of view in which it's surprising
<FromGitter> <bararchy> Can i link to the blog from my twitter ?
<oprypin> yeah
<FromGitter> <mverzilli> <sarcasm>bad comments on Reddit? how come?</sarcasm>
<FromGitter> <bararchy> XD
<FromGitter> <sdogruyol> no way :D
<Groogy> @bararchy it is reddits, it is always gonna get bad comments
<Groogy> if you look at #programming, #c++ and #reddit-gamedev, the attitude of several people there are not.... well it's not #crystal-lang :P
<Groogy> oprypin don't worry about it, be proud of that you contributed to the crystal community and then if someone has genuine good concerns/feedback you respond to those specifically
<FromGitter> <fridgerator> you mean all of reddit?
<FromGitter> <mverzilli> anyway, those 5 bad comments are about Crystal itself, not the blogpost
<FromGitter> <sdogruyol> well I've never seen bad comments on crystal reddit at all
<Groogy> that was my point, the crystal community is so small/young it hasn't gotten there yet
<Groogy> tohugh it is never gonna have the "hurr durr C++ übermensch language" attitude probably
<FromGitter> <sdogruyol> We really value MINASWAN at heart :)
<Groogy> hopefully
<FromGitter> <mverzilli> tru dat, the moment we start getting thousands of negative comments is time to throw a party to our success :P
<FromGitter> <sdogruyol> haha
<FromGitter> <sdogruyol> at that exact moment I'll wear a MINASWAN t-shirt :D
<Groogy> oh I need to get a MINASWAN shirt
<Groogy> I have way too many t-shirts that are programming related ;_;
<oprypin> i have literally 0, how do you get one?
<FromGitter> <fridgerator> has a lot
<Groogy> you are dumb and press on an offer in Facebook ads, and then facebook bombards you with ads of t-shirts about programming
<RX14> i have about 4 free programming tshirts
<RX14> once you're a programmer you never need to buy them again
<oprypin> yeah right
<Groogy> that was my mistake and now I have to hold myself from buying more
<FromGitter> <sdogruyol> well, i also don't buy
<FromGitter> <sdogruyol> I like get them as free swags from conferences / meetups e.g :D
<FromGitter> <sdogruyol> makes some great memories like that
<oprypin> do we have any crystal lang shirts generally available yet?
<FromGitter> <sdogruyol> hmm not sure
<Groogy> can probably print it yourself quite cheaply
<FromGitter> <sdogruyol> I've a Crystal t-shirt
<Groogy> doubt the symbol is trade marked yet?
<Groogy> but of course would be nice to support development that way
<FromGitter> <sdogruyol> not yet i think
<FromGitter> <sdogruyol> here's a sneak peek of how it looks on a real person :D
<FromGitter> <sdogruyol> IMHO it's cool t-shirt
<FromGitter> <sdogruyol> I wear it once in a while at work
<oprypin> well not sure about the text so much
<FromGitter> <sdogruyol> people do stare at me though :D
<Groogy> what text?
<Groogy> can't see on that picture
<oprypin> Groogy, "CRYSTAL", yes you can see it
<Groogy> ah thought there were some more text underneeth
<Groogy> like a motto or something
<oprypin> RX14, pls no it's experimental :(
<FromGitter> <sdogruyol> ugh @RX14 that may get some flame from HN :D
<FromGitter> <sdogruyol> but I think that's OK
<FromGitter> <sdogruyol> upvoted
<Groogy> da hell is ycombinator?
<FromGitter> <sdogruyol> please do upvote and let's get it on 1st page
<Groogy> never seen that before
<FromGitter> <sdogruyol> @Groogy it's Hacker news
<FromGitter> <sdogruyol> pretty much the front page for most of developers
<Groogy> hacker as in traditional sense (i.e a programmer) or media interpetation of hacker?
<Groogy> ah
<Groogy> never ever seen before
<oprypin> no way
<oprypin> sdogruyol, ah that photo on twitter is in Kyiv, isn't it
<FromGitter> <sdogruyol> first question @RX14 :D
<FromGitter> <sdogruyol> @AlexWayfer yes, are you from Ukraine?
<oprypin> wait what
<FromGitter> <sdogruyol> sorry
<FromGitter> <sdogruyol> wrong mention
greengriminal has joined #crystal-lang
<FromGitter> <sdogruyol> @oprypin yes, are you from Ukraine?
<oprypin> i am
<FromGitter> <sdogruyol> Ah wish we had a chance to meet
<oprypin> uhm funnily enough you can already do everything on Windows (10), just add that bash command to your build script and you get only one hidden interaction with Linux
<oprypin> sdogruyol, i'm in Stockholm now anyway
<Groogy> hey oprypin do you know if they've fixed the context/texture sharing problems in SFML yet?
<oprypin> Groogy, i don't think i've heard about that
<Groogy> been ages since I visited SFML and maintained rbSFML
<Groogy> what version is it on now? 2.3?
<oprypin> 2.4.2
<Groogy> oh dang I am way out of date with rbSFML then haha
<Groogy> last supported version was 2.1 I think
<RX14> @sdogruyol replied
<FromGitter> <sdogruyol> just seen it, great reply
<FromGitter> <sdogruyol> 👍
<FromGitter> <sdogruyol> we need a bit more upvoted to get to first page :P
<oprypin> disagree about small PRs. i think the initial big chunk could be anything, just have the core team pretty it up before merging
<RX14> it's on it's way there lol
<RX14> oprypin, it can't be prettied up
<oprypin> how come?
<FromGitter> <sdogruyol> IMHO anything is better than nothing
<RX14> it currently renames files
<RX14> and i don't want to loose the entire blame history
<oprypin> so rename them differently but keep the gist of it
<oprypin> does rename lose blame history though?
<Groogy> only if you do it as seperate git delete and git add
<RX14> oprypin, it's much much easier in the long run to work through the abstractions and copy paste the code into Crystal::System
<Groogy> potentially if git can't spot it themselves
<RX14> Groogy, no git only stores removes and adds
<RX14> even with mv
<Groogy> huh really?
<RX14> the rename detection is an algorithm
<Groogy> but I clearly see it being able to deduce "this is this file"
<RX14> which looks at the diff and tried to detect renames
<RX14> thats how linus wanted it
<oprypin> sure, but there's no reason to lose blame history, that's the whole point of rename detection
<RX14> so thatnewer git repleases could have better rename detection
<Groogy> you sure? because git properly will mark it as a rename?
<RX14> yes but thats based on looking at the diff
<RX14> the diff is created by looking at the two trees
<RX14> not by storing the diff
<Groogy> no that's when you do delete and add
<RX14> diffs are never stored in git
<Groogy> then it will give youa s well how much they match
<Groogy> like renamed (58%)
<oprypin> RX14, doesn't matter! rename keeps blame history, that's all we care about!
<RX14> it still renames the files
<RX14> which is stupid
<oprypin> so get his branch and amend commits that rename them
<Groogy> ^
<oprypin> doesnt mean we should discard that work and start from scratch
<RX14> whatever we merge it would be messy and ugly
<RX14> we are NOT discarding it
<RX14> we are simply refactoring it
<RX14> copy and pasing it into different method bodies
<RX14> the method bodies and the real work will be 99% the same
<RX14> the work has been done we just need to tidy it up
<oprypin> but without attribution..?
<RX14> and thats perfectly possible to do without much windows experience
<RX14> oprypin, if txe wants to help with that work thats fine
<RX14> but how do you propose we do attribution?
snsei has quit [Remote host closed the connection]
<RX14> sure we could set the git commit author to txe
<oprypin> i just think these people who do the work need to have access to direct chat with the team
<RX14> that's what the issue tracker is for
snsei has joined #crystal-lang
<RX14> i don't see the big rush for windows support
<RX14> i want windows support but i want it done right
<RX14> not a mess merged so we can boat about the buggy feature
<RX14> boast*
<FromGitter> <mverzilli> that was already posted
<oprypin> sdogruyol, I suggest you delete that
<FromGitter> <sdogruyol> not on /r/programming
<RX14> it was
<FromGitter> <sdogruyol> really?
<FromGitter> <sdogruyol> deleted sorry
<oprypin> RX14, i want something merged so people who want to add some small windows feature they dont need to go look at that branch and say welp im not dealing with that broken whatever thing
<RX14> if we merge the windows PR we will get around to refactoring to use Crystal::System *much* slower
<RX14> i think that's a bad idea
<RX14> and we should do it right the first time
<RX14> not merge a mess and attempt to clean it up
<oprypin> i'm not signing up for that. if you are, make sure people are aware of that and that it's not too slow
<RX14> well this needs to be the first thing we sort out:
<oprypin> i mean... for my purpose i don't really need that
<RX14> oprypin, IO is part of the prelude
<RX14> so i think even just running without --prelude=empty requires IO to work
<oprypin> txe must have made some workarounds, as that already works
<RX14> well yes
<oprypin> don't know about actually using IO but the prelude is there
<RX14> he ported IO::FileDescriptor
<RX14> we don't need network IO though
<Groogy> ah the /r/programming comments are typical A-class reddit comments ^^
<Groogy> (just found the x-post)
<FromGitter> <sdogruyol> :D
<Groogy> RX14 eh on the conditional compiling of files, the normal way oyu usually do this is just to have the frontend include whatever file that implements the correct backend
<Groogy> SFML is a good example of how they do those things
<Groogy> doubt you would need to put conditions around the entire file?
<oprypin> not really applicable
<oprypin> different programming language and all
<Groogy> yeah I guess
<Groogy> was just reading it and figured it was a bit "overengineering" to a simple problem
<Groogy> oh wait that was last year lol didn't notice
<RX14> Groogy, that's basically what crystal::system is
<RX14> there's a bunch of files which implement the same interface for whatever platform you're compiling for
<RX14> but those are really minimal APIs
<RX14> not entire user-facing classes of the stdlib
<RX14> it's much harder to keep the "fluff" methods which make the standard library easy to use by the average person in sync between multiple platforms than it is to keep just the raw, minimla, platform specific behaviour
snsei has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> divide and conquer :P
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
<oprypin> anyone have any idea what operation could be causing this? unresolved external symbol __powisf2 referenced in function .Float32....Int32..Float32
<oprypin> this is on windows, trying to figure out what math i'm not allowed to do
<Groogy> hmm there's no specific object file that it fails in?
<Groogy> oh right no I guess Crystal have only one single object file?
<oprypin> according to txe's instructions you make one object file
<Groogy> yeah then it's gonna be way harder to find :/
<Groogy> usually saving grace for C/C++ is that the error has an associated object file with it
<RX14> oprypin, looks like something in the LLVM runtime
<RX14> no idea how or why it relates to windows
<oprypin> wow it was literally `x**2`
<oprypin> while `x**2.0` works
<RX14> it's used to take a float to an int
<Groogy> guess the symbol is named differently on the windows version?
<Groogy> that would be weird though
greengriminal has joined #crystal-lang
<Groogy> nice!
sp4rrow has joined #crystal-lang
<FromGitter> <sdogruyol> wow
<FromGitter> <sdogruyol> good job @oprypin
<oprypin> cmon, i just followed instructions
<Groogy> I want my day to be over so I can get home and code in crystal <_<
<Groogy> "I want my work day in coding is over so I can go home and code" - Programmers
<FromGitter> <bew> ahahah
<FromGitter> <sdogruyol> @Groogy I'll quote that :P
<FromGitter> <sdogruyol> @Groogy is that ok? :P
<Groogy> haha yeah though let me correct the english a bit better
<FromGitter> <sdogruyol> oh ok :D
<Groogy> "I want my work day of coding to be over so I can go home and code"
<Groogy> :P
<Groogy> though crystal is hitting the same itch I got with Ruby
<Groogy> it's just plain fun to play in
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> just fun :O ?
<Groogy> Every language is good in their own special way ;D Crystal & Ruby main attraction for me besides being great language wise, they are fun to work in.
<hightower2> But better. I found I can do more/larger blocks of code in Crystal without error than I typically managed in Ruby
<Groogy> though doing vertex processing in Ruby was.... interesting to get running at some kind of speed
<FromGitter> <sdogruyol> how about doing vertex processing in Crystal :P
<Groogy> I am imagining it's going to be childsplay to generate a navmesh in Crystal
<Groogy> yeah I am working towards it :P
<Groogy> was working with serialization yesterday mostly. Tried to solve so I could have a generic class for every class but I think I was overengineering the whole problem really
<Groogy> and... someone told me that and I was being dumb, which I was
<Groogy> don't remember who though
<Groogy> Papierkorb it was
<FromGitter> <sdogruyol> probably
<FromGitter> <sdogruyol> who's txe on github?
<RX14> uhh i think he's txe everywhere
<Groogy> yeah think I've talked to him here as well
<FromGitter> <sdogruyol> haven't seen him yet
<FromGitter> <sdogruyol> is he a windows developer?
<Groogy> i guess so
<Groogy> ow yeah realized one of our build engineers used to work in Ruby, so linked him Crystal
<FromGitter> <sdogruyol> cool, that's some great evangelism spirit @Groogy :D
snsei has joined #crystal-lang
<Groogy> well we have a saying in the game industry
<Groogy> the perfect game doesn't sell itself
<Groogy> though guess that stretches to other industries as well
<FromGitter> <sdogruyol> that's a really great saying
<FromGitter> <sdogruyol> applies to everything
snsei has quit [Ping timeout: 260 seconds]
hightower2 has quit [Ping timeout: 240 seconds]
hightower2 has joined #crystal-lang
<FromGitter> <codenoid> 1) some coffee
<FromGitter> <bararchy> So , who's starting SciCrystal ? ;)
<FromGitter> <LuckyChicken91_twitter> why is there no .downcase in crystal?
<FromGitter> <johnjansen> there is
<FromGitter> <LuckyChicken91_twitter> is there another method to downcase a string
<FromGitter> <LuckyChicken91_twitter> im getting undefined method 'downcase'
<FromGitter> <johnjansen> snippet please :-)
<FromGitter> <LuckyChicken91_twitter> oh i need to do .to_s.downcase not just .downcase
<FromGitter> <LuckyChicken91_twitter> its okay
<FromGitter> <johnjansen> that means the thing is not a string
<FromGitter> <johnjansen> what is it?
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <johnjansen> @LuckyChicken91_twitter there might be a much better way of doing that if you drop some code, we can make suggestions
sp4rrow has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> its a string!
<FromGitter> <LuckyChicken91_twitter> the string is created with 'gets'
<FromGitter> <johnjansen> its a string or nil perhaps
<FromGitter> <bew> gets return type is String | Nil
<FromGitter> <LuckyChicken91_twitter> and then im expecting that its already a string
<FromGitter> <LuckyChicken91_twitter> so i will do gets.to_s in the future
<FromGitter> <bew> btw, `gets.to_s.downcase` works for me
<FromGitter> <bew> oh yeah sorry , I missed some messages above
<FromGitter> <LuckyChicken91_twitter> yes
<FromGitter> <johnjansen> yep … @LuckyChicken91_twitter you need to be mindful of union types that behave differently … unlike ruby, string behaviours arent everywhere
<Groogy> doesn't .to_s make an extra string copy?
<FromGitter> <bew> not necessarily I think
<Groogy> wouldn't it be btter to just rule out it is not a string so the union type is eliminated?
<Groogy> or at least more "The crystal way"
<FromGitter> <johnjansen> in the case of a type of (String|Nil) there isnt always a string though ;-)
<FromGitter> <johnjansen> i agree though, im sure there is a more crystalesque way to do this
<FromGitter> <bew> Groogy: `String#to_s` simply return `ßelf`
<Groogy> ah it does, nice
<FromGitter> <bew> and `Nil#to_s` returns `""`
<FromGitter> <LuckyChicken91_twitter> but generally it makes sense that "gets" is not directly an String .. because its just *getting* an string
<FromGitter> <bew> woops, messed up the s ^^
<Groogy> heh yeah though I got what you meant
<Groogy> that's the german ss
<Groogy> Ich spreche ein bisschen Deutsch
mark_66 has quit [Remote host closed the connection]
<RX14> Crystal::System::FileHandle is getting quite complex with plat-specifics
<FromGitter> <johnjansen> if in doubt abstract ;-)
<RX14> yeah thats what i'm trying, but the abstraction is pretty large
<FromGitter> <johnjansen> abstract again ;-)
<hightower2> How do I perform a regex and put matches into named variables instead of $1, $2, etc.?
<FromGitter> <hugoabonizio> @hightower2
<FromGitter> <LuckyChicken91_twitter> @Groogy ich spreche deutsh
<hightower2> awesome thanks hugoabonizio
<FromGitter> <hugoabonizio> 😄
<Groogy> haha lucky it was for bew since he accidentally wrote a german letter
<Groogy> we get optional German classes in Sweden at elementary school
<FromGitter> <LuckyChicken91_twitter> oh okay
<FromGitter> <bew> No idea how I made that letter though^^ maybe AltGr+s (because I need AltGr for backtick)? Damn french keyboard ^^
<Groogy> Lol you don't live in Alsace do you :P
<FromGitter> <bew> No, in France!
<Groogy> ... you foght a pretty big war to have Alsace mind you :P
<FromGitter> <bew> No Deutch for me
<hightower2> I have a tuple like {"one", "two", "three"}. What's the most efficient way to run a regex and see if any of these words exists in the string, and capture it if yes? (I mean is there something more efficient than converting a tuple into (one|two|three) and then matching that)
<FromGitter> <LuckyChicken91_twitter> i have german keyboard. I can easily type ßäüößßäüöüäßß
<FromGitter> <johnjansen> @hightower2 does it need to be a regex?
<hightower2> johnjansen: in this case, since it matches strictly words with no regex special characters, no. But I do need to know what was matched (the word), not just whether it matches or not.
<FromGitter> <johnjansen>
<FromGitter> <johnjansen>
<hightower2> Right, right, but I don't think it would be pretty useful to run a #each() and try includes? on 12 strings in a row. Or would it, since I can stop as soon as first is found?
<FromGitter> <johnjansen> there are a bunch of possible approaches, how many strings in the tuple and to be compared
<oprypin> hightower2, it would stop as soon as first is found but yeah there are more efficient alrogithms
<hightower2> Ok, will look into it, thanks
<FromGitter> <johnjansen> depending on the size of the list, there is
<oprypin> >> {"one", "two", "three"}.find { |s| "adfgagtwowafg".includes?(s) }
<DeBot> oprypin: # => "two" -
<oprypin> that's the simple way, hightower2
<hightower2> Pretty fine, I can use that, thanks!
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
jplatte has joined #crystal-lang
pwned has quit [Ping timeout: 260 seconds]
<oprypin> hightower2, and this one has large startup time but is probably worth it for large data
greengriminal has quit [Quit: This computer has gone to sleep]
<hightower2> oprypin, pretty cool, I could use that since the tuple items are fixed, so the regex can be precompiled once
<oprypin> hightower2, just dont run into PCRE limitation, iirc max regex size is 65536
greengriminal has joined #crystal-lang
<hightower2> Sure, the list will have max 50-ish chars, when all is joined together
<FromGitter> <johnjansen> @hightower2 @oprypin
<FromGitter> <johnjansen> as a dirty benchmark … regex doesnt do so well
<hightower2> cool
<FromGitter> <johnjansen> and its against pretty hacky code
<oprypin> johnjansen, i accounted for that in my previous message
<oprypin> it is not good for small data, indeed
<FromGitter> <johnjansen> ;-) … the size of the data being compared is indeed the missing factor
<FromGitter> <johnjansen> would be interesting to bench some real world examples though
<FromGitter> <johnjansen> the times flip when the string gets longer
<FromGitter> <johnjansen>
<FromGitter> <johnjansen> so if the array (tuple) is longer then the performance of regex is worse, and if the string is longer, regex is better
<FromGitter> <johnjansen>
<oprypin> johnjansen, please use benchmark module
<FromGitter> <johnjansen> yeah should do that … it was just a quick example … working on something big and tricky at the moment, so not giving this too much though
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
greengriminal has joined #crystal-lang
<FromGitter> <johnjansen> whats weird
Groogy has quit [Disconnected by services]
Groogy2 is now known as Groogy
Groogy_ has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 268 seconds]
<FromGitter> <renich> o/
sp4rrow has quit [Ping timeout: 246 seconds]
<bmcginty> Does anyone have code to unflatten a 1d array into x dimentions in crystal?
<bmcginty> I realize this is a random kind of thing. I've got some code urrently that I'm working on, but it's causing a compiler crash.
<havenwood> bmcginty: Have a small example with expected input and desired result? Gist what you're trying?
<FromGitter> <hugoabonizio> @bmcginty most of the time you can just search for a ruby solution and try it on crystal ⏎ ⏎ ```a = [1, 2, 3, 4, 5, 6] ⏎ a.each_slice(2).to_a # => [[1, 2], [3, 4], [5, 6]]``` []
<bmcginty> hugoabonizio: will try. thanks.
<bmcginty> havenwood: Not quite. I can put something together if hugoabonizio's or other solutions don't pan out though. actually, abstracting this more is a good idea...
<Groogy> exit
<Groogy> ops
Groogy has quit [Quit: WeeChat 1.9]
sp4rrow has joined #crystal-lang
<FromGitter> <fridgerator> Awesome!
<FromGitter> <johnjansen> good work @RX14
<FromGitter> <hugoabonizio> @RX14 congratulations! 🎉
<RX14> to think that they'd invite me just for complaining all the time on this issue tracker...
<FromGitter> <fridgerator> lol
<oprypin> :)
<FromGitter> <mverzilli> lol
<FromGitter> <johnjansen> complaining about real stuff though ;-)
<FromGitter> <bew> Ohh yeah awesome ;)
<RX14> tbh i'm most excited about being able to copy the markdown of github comments finally
<RX14> github should fix that so there's a show source for github comments, instead of needing to press the edit button
<FromGitter> <bew> Ahahah, that would be great indeed!
<FromGitter> <bew> About PR merging: It must have passed CI. This implies that the CI works :D
<RX14> it works... mostly
<FromGitter> <johnjansen> travis is working again?
<FromGitter> <johnjansen> or is it the manas jenkins?
<RX14> travis always worked
<FromGitter> <johnjansen> 1) 23.0 broken any crystal based CI on travis from what i can tell
<FromGitter> <elorest> <RX14> When crystal was changed to 0.23.0 travis didn't work for 5 days or so.
<FromGitter> <johnjansen> is it back @elorest
<FromGitter> <elorest> it was fixed again last wednesday.
<RX14> well it worked for crystal-lang
<RX14> it didn't work for downstream projects
<FromGitter> <johnjansen> ahhh
<FromGitter> <elorest> k
<Papierkorb> Huh that's sounds funky
<RX14> well crystal-lang doesn't use the crystal support at all
<RX14> it builds everything in docker containers inside travis
<RX14> so it was entirely isolated from the issue
<FromGitter> <elorest> I fixed all of my projects but setting travis up to use docker.
<FromGitter> <bew> with llvm segfault on some pr.. :p
<RX14> yeah but thats just your average intermittent segfault
<RX14> i should really try and repro that
<RX14> get a coredump
<Papierkorb> Oh reminds me that I also need to track down a compiler crashbug I found while writing the NamedTuple#merge stuff
<FromGitter> <sdogruyol> @RX14 congrats 🎉
<RX14> thanks
<FromGitter> <konovod> @RX14 grats! 🎉
<FromGitter> <sdogruyol> I'm really glad that the core team is growing stronger 💪
<FromGitter> <crisward> @RX14 You're now the official go to person in the UK for Crystal... looking forward to all those crystal meetups 😉
<RX14> yeah well there'll need to be on in the UK first...
<FromGitter> <sdogruyol> yeah :D
<FromGitter> <sdogruyol> please do start a Crystal user group there
<RX14> i wouldn't know where to start to be prefectly honest
<FromGitter> <crisward> @sdogruyol you're man... he gets everywhere
<FromGitter> <sdogruyol> I'd be happy to help you in any way :)
<FromGitter> <crisward> @RX14 I wouldn't stress it, just keep up the good coding.
<RX14> yeah yeah
<RX14> i wasn't seriously thinking about starting one
<RX14> i'd come along though
<RX14> if i could
<FromGitter> <sdogruyol> why not @RX14 ?
<FromGitter> <elorest> I think for now we should make an effort to do video meetups or something. That could always become physical meetups as well, but our community is small in a lot of cities right now.
<RX14> i'd love if someone else started one but i'm really bad at organising things
<FromGitter> <elorest> We have about 6 people in all of utah and salt lake counties and many of them aren’t the kind of people who go to meetups.
<FromGitter> <crisward> I go to JS meetups in Manchester... but no crystal.
<FromGitter> <elorest> I run the ruby meetup here.
<FromGitter> <elorest> Been speaking on crystal almost every month. Been thinking after I get enough people playing with it I’d transition to a crystal meetup.
<FromGitter> <crisward> I've never done any ruby... just straight to crystal
<FromGitter> <johnjansen> @crisward you got lucky then … although ruby is lovely, crystal is what i wish ruby had always been
<FromGitter> <elorest> Ruby as been my bread and butter for 12 years but I really love crystal. It's made programming fun for me again though.
<FromGitter> <johnjansen> (i dont think the eco-system would have evolved though, so its a catch 22)
<FromGitter> <elorest> Not to talk crap on ruby. I love it too, just more excited about crystal right now.
<FromGitter> <johnjansen> i agree with @elorest in every respect
<FromGitter> <elorest> ✨
<FromGitter> <sdogruyol> same i also agree with @elorest
<FromGitter> <crisward> No what you mean, I've used php and node in the past, crystals type system gives you a sense of security without being a pain to use.
<FromGitter> <sdogruyol> i love Ruby but then i love Crystal
<FromGitter> <crisward> Also like the async, without async everywhere
<FromGitter> <johnjansen> im going to write everything i can in crystal, im sure others feel the same way
<FromGitter> <sdogruyol> same
<FromGitter> <crisward> It'll be even better when some missing gaps in the libs are filled. Been looking into SMTP this evening. Noticed it's on the road map for std-lib
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
<FromGitter> <elorest> Thirded!
<FromGitter> <elorest> Here’s a useful shard in cases where you need to compress a string that isn’t already in IO form.
<RX14> you really shouldn't put compressed data in strings
<RX14> it's not UTF8
<Papierkorb> Please only use String for strings. If you have non-string sequential data, like binary data, use `Bytes` (or another `Slice` type) instead always.
<FromGitter> <elorest> A string isn’t necessarily UTF8 either, and also ruby does it. I guess I could be wrong but it seems very useful to be able to take a string and send it somewhere in compressed form without first putting it in a file.
<RX14> ruby does it
<RX14> but ruby does it wrong
<Papierkorb> Ruby doesn't have Slice, that's why they abuse string for it, like other scripting languages
<RX14> or at least crystal doesn't do it like ruby here
<oprypin> elorest, in Crystal a string isn't UTF-8 is equivalent to "it's broken"
<Papierkorb> Heck even Javascript got it by now
<RX14> in crystal, strings are UTF8
<FromGitter> <elorest> Can I send a slice through http though?
<RX14> never use them for binary
<RX14> we have slice
<oprypin> elorest, yes, that's the primary way of sending things
<RX14> IO is based on slices
<RX14> everything gets transformed into a slice
<RX14> before being written
<oprypin> RX14, what do you think about this syntax
<oprypin> >> "\xff".bytesize
<DeBot> oprypin: # => 1 -
<FromGitter> <elorest> Yes I see that but before an http response is actually sent over the pipes it’s converted into string data of some time isn’t it?
<RX14> the \x?
<oprypin> is it worth raising an issue that it's possible to create nonsense with standard string literals? it's an invalid utf-8 string
<RX14> i don't know why ary introduced it honestly
<oprypin> \x at \x80 and above
<oprypin> ikr
<FromGitter> <elorest> Maybe I just learned that from ruby.
<oprypin> well yes, gotta unlearn it though
<RX14> was added in 0.21.0 oprypin
<Papierkorb> elorest, hopefully not. String data is binary data too.
<FromGitter> <elorest> true...
<FromGitter> <elorest> I guess I’m just used to the concept of posting a string body through http. Obviously at some point lower down it’s still binary.
<Papierkorb> And it's pleasantly easy to turn a String into a Bytes slice
<RX14> .to_slice lol
<oprypin> changed from one broken state to another broken state
<RX14> oprypin, unicode codepoints != binary
<RX14> \xff is invalid unicode
<RX14> \u{ff} is valid unicode
<RX14> and it takes 2 bytes
<oprypin> RX14, in python they are equivalent
<RX14> well
<RX14> python is wrong
<RX14> well
<oprypin> wtf?
<FromGitter> <johnjansen> haha … in so many ways
<FromGitter> <elorest> Anyway even if it shouldn't be used it's still useful to have an easy option to have compressed string values that could be posted into slack and decoded on the other side lol.
<RX14> \u{ff} should be code point 0x00FF
<oprypin> and it is
<RX14> which should be encoded as 1000001 11111111
<RX14> i think
<RX14> which is 2 bytes
<oprypin> RX14, you're saying \x should be binary. but it's part of a text string. how does that make sense?
<RX14> because asterite added it for some reason
<oprypin> it's been there all along by the way
<RX14> no
<RX14> it was added in 0.21.0
<oprypin> what do you mean no, try it ffs
<RX14> well
<RX14> i was only reading the changelog
greengriminal has joined #crystal-lang
<oprypin> 0.21.0 changed it from one type of nonsense to another as I demonstrated earlier
<RX14> thats why
<RX14> ahahaha
<oprypin> OK then. sorry.
<RX14> no plenty of people did the same
<RX14> including me for a good 2 minutes
greengriminal has quit [Client Quit]
<RX14> well
<RX14> we could sit here and complain about it, or we could open an issue
<FromGitter> <mverzilli> I'm texting from a phone on a boat, so excuse if I sound terse, but IRC Ary introduced that because there was no other simple way to get arbitrary binary content into the data section of the program
<RX14> or at least comment on the commit that added them back
<RX14> @mverzilli yes that was my impression at the time
<RX14> however I think a new slice literal would have been much better
<RX14> even just a %() string with a custom modifier
<RX14> like %s()
<RX14> and that allows you to use binary escapes
<Papierkorb> `ConstantBytes.from_file "foo.bin"`
<RX14> and returns a slice
<RX14> well how would that be implemented Papierkorb
<FromGitter> <mverzilli> I remember having proposed that to him and as usual he had an interesting angle I wouldn't ever had considered
<oprypin> RX14, yeah im just trying to understand it. i mean, it's a recent addition by the core team, i cant just go and challenge it in an issue again
<RX14> well
greengriminal has joined #crystal-lang
<RX14> somehow i reall there being an issue
<RX14> but it wasn't linked from the commit that readded them
<oprypin> "get arbitrary binary content into the data section of the program" - that's valid but perhaps there should be a different way to do that
<FromGitter> <mverzilli> As soon as I can I'll ask him again
<Papierkorb> RX14: some yet-to-be-implemented macro magic. If e.g. `ConstantBytes[ 0xff, ... ]` would be implemented, then that could be done through a simple macro
<oprypin> yeah there should be a slice literal for that
<Papierkorb> ...
<RX14> thing is, all macros go -> string -> parse again
<RX14> at least iirc
<FromGitter> <renich> How can I unset a variable?
<Papierkorb> something like that, sure. Could be made a special-function later on. I mean one could fake that right now by constructing a String (*cough*) and returning it as Bytes from that thing, or by constructing a Bytes[..] (but that's boring as in, run-time constructed)
<Papierkorb> renich, you can't. What do you need it for?
<RX14> what do you mean by "unset"
<RX14> what do you hope to achive by "unsetting" a variable
<FromGitter> <renich> I want to make sure that var is nothing
<FromGitter> <renich> So I can reuse the name with confidence
<oprypin> let's suppose that you could unset it. how would that affect the rest of the program? you'd just get a compilation error
<RX14> just assign it again
<FromGitter> <renich> OK
<RX14> if there's multiple code paths, assign nil at the start
<oprypin> yes, it's equivalent to unsetting and setting, reall
<RX14> it's all SSA in the end lol
<Papierkorb> Mh I think I have an idea for a hack to build that constant data stuff ..
<oprypin> you can write about it in the earlier mentioned issue
greengriminal has quit [Quit: This computer has gone to sleep]
<hightower2> Can I somehow break from #each
<hightower2> mm, it appears 'return' would work?
<hightower2> actually not
<FromGitter> <johnjansen> does `break` not work?
<Papierkorb> break with break
<hightower2> Ah, it's icr skewing results
<FromGitter> <crisward> break works...
<FromGitter> <crisward> ie ⏎ ⏎ ```(1..5).each do |num| ⏎ p num ⏎ break if num > 2 ⏎ end``` []
Groogy has joined #crystal-lang
<hightower2> Here's what I'm trying to do actually. I'm trying to have a hash or enum basically, with Sun => 0, Mon => 1 etc. And I then want to parse a string for any mention of "Sun" or "Mon", and depending on which is found, I want to return 0 or 1.
<hightower2> I've tried this with Tuples, NamedTuples, Hashes and Enums, and in each case there is some data conversion that I don't like
<oprypin> hightower2, have you seen btw?
<hightower2> What's optimal to do here? To have two types of representation, one as a Tuple (for a list of words) and another as a Hash, for lookup of the value?
<FromGitter> <johnjansen> so ⏎ ⏎ ```Sun => 0, ⏎ Mon => 1, ⏎ Tue => 1, ⏎ Wed => 0,``` []
<FromGitter> <johnjansen> ?
<hightower2> oprypin, yes, but I have to both call #to_s for when I want to search particular value in the string, and then additional I need to call #parse to convert string to enum object
<hightower2> johnjansen, yes, 0, 1, 3, 4, 5, 6 for weekdays
<oprypin> hightower2, that's a weird situation
<oprypin> oh so you dont have just 2 days
<FromGitter> <johnjansen> what id the string contains several of them?
<FromGitter> <johnjansen> is that a case?
<hightower2> I have 0..6 for weekdays, and 1..12 for months
<oprypin> hightower2, ok let's try Hash. you turn the keys into a regex or whatever you decided to do. what's the problem?
<hightower2> oprypin, right, that'd work... I could do something like hash.each { |k,v| break v if string.includes? k }
<FromGitter> <johnjansen> are you handling multiple versions of each day … like `mon, Mon, Monday, monday` etc
<hightower2> no, although a version with a hash would allow for it
<oprypin> hightower2, hash.keys.find string.includes? k
<oprypin> not real syntax, { } omitted
<hightower2> Wouldn't hash.keys create an array each time?
<oprypin> what you wrote there is the exact thing `find` does but simpler
<FromGitter> <johnjansen> rather than looking for a datastructure or process then defining the problem, can you define the problem and then look for the right solution
<FromGitter> <johnjansen> :-)
<oprypin> hightower2, that is true. so do it once then, i dont know
<oprypin> hightower2, hash.each_key.find string.includes? k
<hightower2> hm, found another problem which is that #includes?( k) matches anywhere (including "wedding") rather than words only, like \bwed\b
<hightower2> seems I'll need to use string.index /regex/, which then compiles a regex each time
<oprypin> hightower2, sure, that'd be a good idea then
<oprypin> in my example from earlier i meant to make you aware of this
<oprypin> >> {"one", "two", "three"}.find { |s| "adfgagtwowafg".includes?(s) }
<DeBot> oprypin: # => "two" -
<hightower2> Since I need to convert word to an int basically, what I'll do is have a tuple of precompiled regexes, and then I'll just do regexes.each_with_index { |r,v| return v if string.index r}
<oprypin> no no no
<hightower2> what's your suggestion?
<oprypin> hightower2, i sent you an example with regex earlier, wish i could find it
<oprypin> got it
<FromGitter> <johnjansen> there were actually a bunch of suggestions some perform better than others depending on the length of string
<oprypin> but now regex is almost a hard requirement
<FromGitter> <johnjansen> seems so, and given the actual problem, i don’t think it needs to be magically generated from a hash
<FromGitter> <johnjansen> or array, or tuple etc ...
<FromGitter> <johnjansen> its not like you will ever need to redefine days of the week or months
<DissonantGuile> How would I determine the current build platform in the code? Maybe a macro?
<hightower2> oprypin, oh right, it was a slightly different problem but I could reuse it
<DissonantGuile> I wanna use two separate libraries that do the same thing, one for linux and one for osx
<oprypin> hightower2,
<FromGitter> <renich> Could I put a NamedTuple on a YAML file?
<oprypin> renich, no
<FromGitter> <renich> @oprypin thanks
<hightower2> thanks oprypin
<DissonantGuile> Ah that's it, thanks alot!
<oprypin> hightower2, dont even need regex.escape because you never have special symbols in day names but it's for good measure
<hightower2> right
<FromGitter> <johnjansen> @hightower2 how big is the string you will be searching?
<hightower2> very short, 20-30 chars max
<oprypin> johnjansen, dont forget about that `\b` part, very annoying to reimplement that
* hightower2 glorifies Hash#invert
<FromGitter> <johnjansen> ;-) thats why im trying to get a handle on the edge cases like is “SunMon” Sun & Mon, or neither
<FromGitter> <johnjansen> and would string.split(/\s/) be representative of word delimiters etc
<FromGitter> <renich> is broken
<hightower2> johnjansen: it would
<oprypin> johnjansen, but there's no point in doing that. just fragile and slower
<FromGitter> <johnjansen> i get that ;-)
<oprypin> renich, clear browser cookies
<FromGitter> <johnjansen> although slower is questionable from the earlier benchmarks
<oprypin> renich, or first save them if you want to help reproduce this problem
<FromGitter> <renich> OK
<hightower2> (plus it would have to support upper/lower case letters, so regex seems best bet)
<oprypin> renich, actually just try that site in incognito mode
<oprypin> then you know you need to clear cookies
<oprypin> if it works there
<oprypin> hightower2, bah why didnt you say earlier, now it becomes annoying to use the Hash
<FromGitter> <renich> @oprypin nope, not even incognito. It just loads forever...
<oprypin> works for me
<oprypin> renich, are you sure it's not the program that you're feeding to it?
<hightower2> works for me renich
<hightower2> oprypin, every approach has some problem
<FromGitter> <renich> curl doesn't hang, though
<FromGitter> <renich> Can't even get to put the program there... white page
<FromGitter> <renich> This is odd. Sometimes, it works.
<FromGitter> <renich> some JS is kating forever
<FromGitter> <renich> A CDN problem?
<FromGitter> <renich> it works now
<FromGitter> <renich> OK, so, back to my original thing:
<FromGitter> <renich> This works... Is there any better way of doing it? The string inside fetch comes from a config file.
<oprypin> i mean making it into 0 is weird
<FromGitter> <renich> oprypin: what would you do?
<FromGitter> <renich> oprypin: raise an exception, maybe?
<oprypin> exactly
<FromGitter> <renich> OK.
<oprypin> renich, just use `multiplier["GH"]` then, that raises an exception for you
<FromGitter> <renich> oprypin: thanks
<FromGitter> <renich> OK
<FromGitter> <renich> hah, that easy?
<FromGitter> <renich> I thought NamedTuples used Symbols only
<FromGitter> <renich> cool
<oprypin> oh wait, this is namedtuple, sorry
<oprypin> but yeah, that still works
<FromGitter> <renich> oprypin: yes, it does. Thanks man. Sorry to bother so much...
<FromGitter> <renich> But I am grateful
deep-book-gk_ has joined #crystal-lang
<oprypin> hightower2,
deep-book-gk_ has left #crystal-lang [#crystal-lang]
<hightower2> oprypin, hehe, that's a good one. In the end I just went with upcasing the string before doing the regex, and what further complicates the thing is that I need both a mapping from word to number, and from number to word
<hightower2> So in that light, seems like the solution with hashes is best
<hightower2> (I simply have Weekday2Int= { "name" => number, ...} and Int2Weekday = Weekday2Int.invert
<oprypin> hightower2, with enums `` `Day.parse(str).value
<hightower2> Right, right. I wanted to avoid the constant use of to_s and parse
<oprypin> but sure hashes work, enum is kind of a hack because we're abusing the fact that identifiers happen to be strings
<oprypin> thats good
<hightower2> right
<hightower2> And for serialization to yaml I'm gonna need more than one converter class, but that's simple
<oprypin> renich, btw that thing doesnt have to be a namedtuple, a Hash is a more proper usage. and then you could in fact store it in a yaml file (if that's what you were mentioning earlier)
<FromGitter> <renich> oprypin: ah, great. Thanks.
<FromGitter> <renich> why doesn't `crystal play` show the types and values? Especially when I do `require "./src/<app>/*"`
<FromGitter> <renich> I mean, if I don't do the require, it works fine.
<oprypin> not sure.
<FromGitter> <renich> I was hoping it was a known bug
<oprypin> i mean it could be an unknown bug, would be nice to try to reproduce it
<FromGitter> <renich> I'll try to set up a minimal thing later, so I can post it.
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 276 seconds]
xiljin has quit [Ping timeout: 240 seconds]
xiljin has joined #crystal-lang