<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 β ` ... [https://gitter.im/crystal-lang/crystal?at=59633c3a1c8697534a0b37cc]
<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
<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) https://git.io/vQPnT
<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>
you can still structure things in a text/log format so it looks decent
<Yxhuvud>
hmm, if you use https://github.com/yxhuvud/hdrhistogram I think you'd get that more or less for free as it works with the graph tool at hdrhistogram.org. 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) https://git.io/vQPc4
<FromGitter>
<bararchy> looks like civ from file names
<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
<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
<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 :)
<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
<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
<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
<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>
<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.
<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
<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]
<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]]``` [https://gitter.im/crystal-lang/crystal?at=5963d8793230e14f3a45e145]
<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...
<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. https://github.com/elorest/str_compressor
<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
<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
<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>
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
<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 ..
<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
<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?
<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
<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
<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
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.new(int).to_s` `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 somefile.cr` 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.