ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
<FromGitter> <georgeu2000> How can
<FromGitter> <georgeu2000> HTTP::Server is not responding to the interrupt signal. ⏎ How can I trap the signal? ⏎ ⏎ ```Signal::INT.trap do |x| ⏎ puts "Handling INT" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=59d57b1501110b72317a3f3d]
<FromGitter> <georgeu2000> How can the `Server` trap the signal?
<FromGitter> <georgeu2000> ```server = HTTP::Server.new( bind, port ) do |context| ⏎ ... ⏎ end ⏎ server.listen``` [https://gitter.im/crystal-lang/crystal?at=59d57b5bf7299e8f53ac766d]
_whitelogger has joined #crystal-lang
cerulean has quit [Ping timeout: 240 seconds]
cerulean has joined #crystal-lang
<FromGitter> <georgeu2000> That was easy: ⏎ ⏎ ```Signal::INT.trap do |x| ⏎ puts "Handling INT" ⏎ end ⏎ server.listen``` [https://gitter.im/crystal-lang/crystal?at=59d59495614889d47577f7b4]
_whitelogger has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <georgeu2000> Can you have a property for class variables?
rohitpaulk has joined #crystal-lang
dannyAAM has quit [Ping timeout: 246 seconds]
dannyAAM has joined #crystal-lang
<FromGitter> <sdogruyol> @georgeu2000 property?
<FromGitter> <georgeu2000> https://crystal-lang.org/api/0.20.0/Object.html#property%28%2Anames%29-macro
<FromGitter> <sdogruyol> those are only for instance variables
<FromGitter> <georgeu2000> OK thanks.
<FromGitter> <georgeu2000> What is a "HTTP Client Response"? ⏎ https://crystal-lang.org/api/0.23.1/HTTP/Client/Response.html
<FromGitter> <georgeu2000> So it is the Client's response from the Server.
<FromGitter> <georgeu2000> Thanks.
<FromGitter> <georgeu2000> It makes sense but it is a funny name.
Bablzz has joined #crystal-lang
Bablzz has quit [Ping timeout: 260 seconds]
<FromGitter> <georgeu2000> @jwaldrip - This doesn't really make any sense: ⏎ ⏎ > Lets define the routers's root route. root is simply an alias for get '/', action. All routes can either be a String pointing to a Controller action or a Proc accepting HTTP::Server::Context as a single argument. If a String is used like controller#action, it will expand into Controller.new(context : HTTP::Server::Context).action, therefor A
<FromGitter> ... controller must have an initializer that takes HTTP::Server::Context as an argument, and the specified action must not contain arguments. ⏎ ⏎ Can you provide examples for both types of route? [https://gitter.im/crystal-lang/crystal?at=59d5b976614889d475788302]
<FromGitter> <georgeu2000> I have: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59d5b98bf7299e8f53ad6571]
<FromGitter> <georgeu2000> And I get ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59d5b9a9bbbf9f1a38245340]
cerulean has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Ping timeout: 264 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
cerulean has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
Papierkorb_ has joined #crystal-lang
<Papierkorb_> Morning
alex`` has joined #crystal-lang
<FromGitter> <imonmyown> Morning guys
<Groogy> Hiya! o/
claudiuinberlin has joined #crystal-lang
<FromGitter> <Rinkana> Good morning :)
mark_66 has joined #crystal-lang
<FromGitter> <bew> @sdogruyol @georgeu2000 there is `class_property`!
snsei_ has joined #crystal-lang
<FromGitter> <monouser7dig> > is there a way I can bundle the static files in with the binary? just so I only have to worry about a single-file for deployment @OldhamMade https://github.com/crystal-lang/crystal/issues/1649#issuecomment-144154758 as a crude way ⏎ ⏎ can't help but a bit surprised it was that easy to compile for alpine 😄
snsei has quit [Ping timeout: 258 seconds]
snsei_ has quit [Remote host closed the connection]
<Papierkorb_> https://wiki.postgresql.org/wiki/New_in_postgres_10 PSQL10 is looking good
snsei has joined #crystal-lang
<FromGitter> <monouser7dig> ===bigdata; buzzword compliance, checked 📈===
<FromGitter> <monouser7dig> ouch was not ment to be all that big, forgot about markdown
<Papierkorb_> at least not "web scale", and partitioning solves a real-world issue too
<FromGitter> <monouser7dig> okay 👍
<Groogy> wow on the being able to read file statically
<Groogy> that means I can put my shaders in a seperate file and load it in at compile time
<Groogy> that is amazing
<Papierkorb_> Not portable
<Papierkorb_> Or better: Won't work on Windows
<FromGitter> <monouser7dig> back again to cross compilation if you compile on Mac and set the target to win 😄 well propbably a whole bunch of other problems 😄
<Groogy> well could potentially implement a macro that abstracts it for you?
<Groogy> just have the macro switch between cat and type
<FromGitter> <monouser7dig> yes switch should be possible, that was mentioned somewhere
<Papierkorb_> Groogy: Yes of course, `flag?(:windows)` ftw
<FromGitter> <monouser7dig> do you know when do I have to escape the macro `{` like `\{` ?
<FromGitter> <bew> when you define a macro in a macro
<FromGitter> <monouser7dig> 👍 aah thanks
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> also don't do \{ when it doesn't need to, it will work but confuse the hell out of you because it seems to break any \{ coming after that that actually needs it
<Groogy> I got stuck on that for an hour a few days ago
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <monouser7dig> like {{{ def_my_macro }}?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<livcd> so I have heard the compilation times for Crystal are not ideal yet
<Papierkorb_> you made something?
<Papierkorb_> livcd: ?
<livcd> nah
<Papierkorb_> Was already wondering, that read to me like a grand opening for a message like "So I fixed it, see PR!" ;)
<Papierkorb_> livcd: They're not abhorrent imho, but fact is "faster is better".
<livcd> Papierkorb_: i stumbled upon one of Jonathan Blow's videos about his Jai language and he was talking about how fast it compiles and lah lah...So i was just wondering why is that so and how does it compare to Crystal (in terms of why and how)
<FromGitter> <monouser7dig> if you omit `--release` it is actually much faster for the time where --release is not required
<FromGitter> <monouser7dig> he enforces types everywhere, type inference in crystal is the thing that takes long (besides optimizations)
<FromGitter> <monouser7dig> another difference is that crystal has test cases for their compiler 😄 ✨
<livcd> thanks monouser7dig
<FromGitter> <monouser7dig> he also has type inference I see but he is not based on llvm afaik so he writes everything himself (a friend who looked a bit more at this said that his presentations/ programs sometimes crash at times which may be caused by the "do it all yourself") although this is not based on actual facts
<Papierkorb_> crystal does its own type inference
<FromGitter> <sdogruyol> morning everyone
<FromGitter> <monouser7dig> https://github.com/crystal-lang/crystal/issues/4864#issue-251536917 where asterite made some comments on the compiler speed
rohitpaulk has quit [Read error: Connection reset by peer]
<FromGitter> <crisward> Morning!
<Papierkorb_> Let
<Papierkorb_> Let's hope no one's gonna kill the language to get debug compile times from 2s to 1s
claudiuinberlin has joined #crystal-lang
<FromGitter> <monouser7dig> I think this has been postponed as they say in their new year plan that this may just as well be improved later and they don't have particularly many resources to spare (and Nr.1 goal threads in the works) thus `later` should be accurate and after 1.0 no breaking changes so you should be safe 😄
<Groogy> Wait are you guys talking about the creator of Braid?
<Papierkorb_> Groogy: Jai is by the guy who created Braid?
<Groogy> yeah
<Papierkorb_> amazing
<Groogy> he also made the witness I think
<FromGitter> <codenoid> oh cool, 10k commit
<Groogy> indie game dev makes a language -> language is unstable -> more news at 11
<Groogy> ;D
<Groogy> game devs like to cheat
<Papierkorb_> lawl
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <monouser7dig> haha 😄
rohitpaulk has joined #crystal-lang
xiljin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
xiljin has quit [Quit: ...]
<FromGitter> <imonmyown> Yeah, Jon Blow did do amazing things
<FromGitter> <imonmyown> Hopefully more will follow
xiljin has joined #crystal-lang
xiljin has quit [Client Quit]
<FromGitter> <imonmyown> If crystal could get jai's compilation times keeping its speeds it would be a killer language
<Papierkorb_> I think Crystal is already a "killer" language, all things considered. Improvements are always possible, and they'll be made once time comes, but really, it's already in an overall good state. Not v1.0 state, but heading there. "Faster X" is always nice, but not at the price of sacrificing bigger parts of your goals.
<Papierkorb_> Some things are inherently slow. But many things can be made faster through other means, e.g., a different data structures and algorithms.
<FromGitter> <monouser7dig> ^ 👍
<Papierkorb_> IMO total compilation times for the default --debug builds are fine. They're comparable to what an equivalent ruby script would've taken to load all code it needs.
<Papierkorb_> And memory load .. Yeah less is nice, but as long you're not working on the compiler, you don't compile the compiler every 5 minutes. I'd argue that for the common small to medium projects ("micro services"), compilation time and memory load are perfectly acceptable compared to other languages.
<Papierkorb_> It's not like Java or Go or C++ compile in 0 seconds (Ok, Go is pretty darn fast, but look at what cost), and at least C++ (Dunno about the others) quickly eats up memory (At least when linking). I see "Crystal compiling is too slow!11" as artifact of influx of people who're used to scripting languages, where compilation times are thought of as "load time of my libs".
<Papierkorb_> Doesn't mean that faster isn't nicer, but is it really that big of a problem right now?
<FromGitter> <imonmyown> @Papierkorb_ I don't argue :)
<FromGitter> <imonmyown> I like crystal a lot
<livcd> in any way the most important thing (for me) is reaching 1.0 and then attracting people
<livcd> a killer language that nobody uses is a bit...you know
<Papierkorb_> imonmyown, wasn't meant to be directed towards you in its entirety. If you didn't like what you've seen, you would've left already. You're still here though, and this community is happy about that :)
<FromGitter> <imonmyown> @Papierkorb_ thanks for the welcoming words, this means a lot to newcomers
<Groogy> "long compilation times" you guys are cute :P
<Groogy> C++ can be increadibly slow if you are just lazy about how you do things
<Papierkorb_> Groogy: Boost Sphinx. It's incredible what you can do with templating in C++, it's a complete new language. And it's incredible how slow it is to just #include that darn header. Jeez. It's been years and I still have nightmares about it
Papierkorb_ has quit [Quit: Konversation terminated!]
Papierkorb_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<livcd> Groogy: ahh actually nobody was complaining. I was just curious what slow meant and how it compared to Jai
<Groogy> I was just more lamenting over my own compilation times
<Groogy> because people done dumb stuff over the years
<Papierkorb_> livcd: TL;DR from my experience: Comparable (if not faster) to Ruby code-loading doing similar things.
<Groogy> what's Boost Sphinx?
<Papierkorb_> ... ah man did I get that name wrong again? Afaik, it let you write and "store" (almost?) arbitrary expressions in a AST-esque form, and then later run them on data. No C++11 lambdas
<Papierkorb_> Might have been Boost.Proto by looking at the examples
<FromGitter> <imonmyown> What's the equivalent of `collect` in crystal?
<FromGitter> <Rinkana> https://crystal-lang.org/api/0.20.3/Enumerable.html#select%28%26block%3AT-%3E%29-instance-method
<FromGitter> <imonmyown> Thanks man
<FromGitter> <Rinkana> Or map
<FromGitter> <Rinkana> `["a", "b", "c"].map{|x| x + "TEST"}`
<FromGitter> <imonmyown> cool, got it :)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <imonmyown> Guys do you plan meetups or something in Europe?
<FromGitter> <Rinkana> EuRuKo was last week :P
<FromGitter> <imonmyown> ha-ha missed that one :)
<FromGitter> <Rinkana> But for now it's mostly Ruby meetups that also have some Crystal. Not much Crystal only
rohitpaulk has joined #crystal-lang
<FromGitter> <Rinkana> Not yet at least :D
<FromGitter> <imonmyown> Well I'm not really interested in Ruby that much now
<FromGitter> <imonmyown> Even though I'm from that background
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <imonmyown> Seems like I would have to show tolerance to some of the speakers...
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<Groogy> I would love to go on a meetup, though I don't keep track of much Ruby conferences
<FromGitter> <imonmyown> I'd like to attend something totally informal, but I don't see those kinds of events usually
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<Groogy> Crystal kind of triggered me to develop our internal script language a bit more here
<Groogy> already the content designers are using the new features for things I didn't expect
<Groogy> One of the things were so hacky I went now I have to add conditional compilation for the script just so they don't have to hack it in xD
<FromGitter> <imonmyown> @Groogy, so you're a bit of a language architect, right? :)
<FromGitter> <Rinkana> You have your own scripting language? Mind if i ask why not go for something "standard" like LUA?
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
<Groogy> We've had it for like.... ever?
<Groogy> Also it is faster than Lua (it's a name, not an acronym :P)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> @imonmyown haha a bit but not at the same degree as the people working on Crystal :)
<Groogy> The language isn't a all-purpose one like these ones are. It is specifically targetted at the games we make. So it is really simple, but through a lot of individual simple parts our scripters have managed to create really complex things
claudiuinberlin has joined #crystal-lang
<Groogy> example of the definition of catholic religion in EU4 as an example
rohitpaulk has joined #crystal-lang
<FromGitter> <Rinkana> Ah i see
<Papierkorb_> Declarative <3
<Groogy> I've been adding more and more dynamic stuff to it, like if-cases, switch, etc.
<Groogy> every_country = { limit = { has_country_flag = some_flag } do_things = yes }
<Groogy> is our loops for instance
<FromGitter> <Rinkana> Looks fancy, how long does it take an avarage new employee to get a hold of it?
<Papierkorb_> Groogy: It reads a bit like declarative-style Lua code
<Groogy> Not that long, it in a way is very much "english" in a way
<Groogy> the language constructs is also written in such a way that the AI can inspect the effect of them, the UI etc.
<Groogy> so when I implement new features I usually delegate it to the script language since it is really darned fast but it also gives me all of those things for free
<FromGitter> <Rinkana> Yeah, that's why i was wondering. I looks like you can get most of it within a few days
<Groogy> and that's why I am so loved by the content designers and modders ^^
<Groogy> I also made a profiler for them
<Groogy> modder asked me nicely
<Groogy> ;D
<FromGitter> <Rinkana> And how does it stack up performance wise? It looks like it's not that big of an impact
<Groogy> You can of course break performance like any language, but I think we had some students from a university do performance test on it. A guy at the company wanted us to switch to Lua so we kinda did a "prove that it is worth it"
<Groogy> and it ended up showing that we were like 4-6x faster than Lua
<FromGitter> <imonmyown> @Groogy are you in any way related to David H. H.?
<Groogy> for doing a similar task
<Groogy> nope, no idea who that is
<FromGitter> <sdogruyol> DHH?
<FromGitter> <Rinkana> Creator of Rails
<Papierkorb_> Groogy: LuaJit?
<FromGitter> <sdogruyol> lol
<FromGitter> <Rinkana> But i guess Lua has more overhead because it's more extensible. So it is somewhat expected.
<Papierkorb_> Though Lua has the side effect that it's turing complete. I'm not sure if Groogy's language is, so that alone may be a keeper
<FromGitter> <Rinkana> The best thing about Lua is that many people already know it.
<Groogy> Papierkorb our language essentially becomes direct maps to a C++ object
<Groogy> and just calls "Evaluate" on it
<Groogy> it's hard to beat that
<FromGitter> <monouser7dig> > **<Groogy>** https://pastebin.com/NW0i3h0P looks like a JSON interpreter 😄
<FromGitter> <Rinkana> And you don't need to be turing complete in cases like this
<Groogy> no it is very specific to our gamesand works great
<Groogy> there's tons of stuff to improve
<Groogy> like we don't do arithmetics and so on..... yet ;D
<Papierkorb_> Rinkana, no need? It may be a requirement
<Papierkorb_> Non-turing complete stuff is easy to reason about
<FromGitter> <monouser7dig> brainfuck is touring complete so this is definitely not a goal in itself 😄
<Groogy> just keep in mind this language developed from "Meh I need to read some random shit from a file"
<FromGitter> <Rinkana> Well it's technically turing complete. It's not tested afaik
<Papierkorb_> Groogy: Which sounds why it's basically directly mapped into C++ objects ^^;
<Groogy> I am just amazed at like how I can keep adding stuff and improve it
<Groogy> It's not perfect, but it is ours :D
<Papierkorb_> Which is almost always good enough
<Groogy> though I am starting to sweat as I am seeing the content designer starting to abuse my meta scripts..... (added meta programming to the language a few months ago)
<Groogy> "will this work?" "maaaybe...... holy fucking shit it actually worked?"
<Groogy> how I imagine the devs at Manas feel every day
<FromGitter> <sdogruyol> haha lol
<FromGitter> <Rinkana> More like how every dev feels all day.
<FromGitter> <sdogruyol> you should definitely ask that to @asterite
<FromGitter> <Rinkana> That, or "why doesn't this work"
<Groogy> Our content designers can create their own "functions" now in the script. Though you couldn't do arguments to them.
<Groogy> So I added "meta scripts" which would take at load time an argument and parse it in to that "function"
<Groogy> i.e macros essentially.
<Groogy> And now they've been using it for a while and.....
<Groogy> Σ(゚Д゚ )
<Groogy> "that's not what it was meant to be used for"
<FromGitter> <Rinkana> Might need to start doing script reviews (if you are not doing that already 📦 )
<Groogy> yeah we are now
<Groogy> I mean they are not breaking anything, I am just amazed what they manage to utilize things for
<Groogy> gonna add conditional compiling tomorrow to make the scripts a bit prettier
<FromGitter> <monouser7dig> considering that rx14 said a library had some issues with code quality it would actually be good to have an option to get reviews from crystal people that know good practices and have a label for a lib that passes such a review, cpp has considered something like this, it is like boost but just a label, not a library
<Groogy> I mean I talk a lot in here to learn from the people more experienced
<Groogy> i.e what is the "Crystal-ish" way to write the code
<Groogy> I am happy how small some parts of my code is, unhappy that some parts have these huge blobs of big methods :/
<FromGitter> <monouser7dig> huge blobs in the crystal implementation or where?
<FromGitter> <Rinkana> I feel that most of the Crystal users are ex-interpeted users. And that creates some thinking differences. Myself included.
<FromGitter> <monouser7dig> https://github.com/crystal-lang/crystal/tree/master/samples these could also be touched again cause e.g. the bin-tree gave me bit of a *sigh* moment .....samples should be more expressive I think and not copied (although the reason for copying seems that they can be benchmarked)
<Groogy> No I meant in my library
<Groogy> my Vector and Matrix implementations are pretty nice, but then I look at let's say.... Text
<Groogy> :(
ShalokShalom_ has joined #crystal-lang
<Papierkorb_> Groogy: Do you have a specific example?
<FromGitter> <Rinkana> I think he means this
<Groogy> yeah I am not happy about how the graphics classes look
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <Rinkana> I think we both have the same issue, but on the other end of the spectrum :P
ShalokShalom has quit [Ping timeout: 240 seconds]
<Papierkorb_> I primarily see some #each blocks that could be refactored into their own methods
<Groogy> the shader source though I found out I can put in its own file and read it in though at ocmpile time which is gonna be nice :D
<Groogy> Please do tell me what ones? :D
<Groogy> might also just put the entire vertex creation code in its own file
<Groogy> I split off several things from text.cr to its own folder
<Groogy> hmm actually yeah when I get home I'll split off the vertex building to its own structure and put the info needed to build them in there (like the rebuild flag, etc.)
<Papierkorb_> Groogy: The "issue" (I can't think of a better word right away, so quoted) is not that your code is 'bad' in any way. But you could exploit more pipelining behaviour
<FromGitter> <OldhamMade> it might be good to have a "Zen of Crystal" in the gitbook. it's a great resource in the python community, and IIRC they've done one for Erlang and Elixir to help the influx of new users to those communities.
<Groogy> yeah
<Papierkorb_> E.g., the { line.glyphs[idx], line.colors[idx] } duo could be replaced by standard #zip in the first step.
foca has quit [Ping timeout: 240 seconds]
<Papierkorb_> That yields, so if you can use the block, you don't even have a performance penality for it.
<Groogy> hmm example? _Never used #zip
<Papierkorb_> `[1,2,3].zip(%[one two three])` => [{1, "one"}, ...]
rohitpaulk has joined #crystal-lang
<Papierkorb_> Enumerable#zip takes a block, in which case it doesn't build that array
<Papierkorb_> `%w[one two three]`*
<Groogy> oh so it createsa tuple for each pair?
<Groogy> that's pretty nice
<FromGitter> <Rinkana> Hmm, i do wonder if 0.24 will have many breaking changes
<RX14> yes
<RX14> you can actually find out
<RX14> by looking at the next milestone
<RX14> and looking for things tagged breaking
<FromGitter> <Rinkana> Ah fancy!
<Groogy> oh I should have a look at that as well
<FromGitter> <Rinkana> Here's the link
foca has joined #crystal-lang
<Groogy> thx
<Groogy> hmm time does affect me
<FromGitter> <monouser7dig> @groogy when I clone your project and run shards install and then cd into src and try to run `crystal tool hierarchy boleite.cr` crystal still complains it can not require crystal-clear although it is in the lib folder ?
<Groogy> eh I updated crystal-clear the other day, haven't done so for my project yet
<Groogy> but it should still be able to find the project
<FromGitter> <Rinkana> My game clock is not being used atm so it does not affect me (yet)
<FromGitter> <Rinkana> Here are some performace optimalizations that will have an impact :)
<Groogy> really nice breaking changes to be honest :)
<Groogy> I've never used the hierarchy tool, is it capable of finding the libs by itself?
<FromGitter> <monouser7dig> it is the same if I try to build
<FromGitter> <monouser7dig> I never used it either yet but figured this would be a good first time
<Groogy> hmm build works just fine for me, is the version of the shard locked or something?
<Groogy> or well I am not at home so I cna't say for sure it works fine :P
<RX14> the problem is the cd into src
<RX14> you always run crystal from the project root
<Groogy> oh he wasn't runnig it from root?
<RX14> it finds libs by looking for the libs folder in the current directory
<FromGitter> <monouser7dig> and then crystal build ./src/x.cr ?
<RX14> actually lib folder
<Groogy> yeah
<RX14> ideally shards build
<RX14> but nobody uses it :(
<Groogy> I do, I think my handmade script for VS Code uses it ^^
<Groogy> but yeah it won't compile right now monouser7dig just so you know
<FromGitter> <monouser7dig> shards build is an alias for what I just wrote>
<Groogy> I haven't updated it to my latest changes in crystal-clear
<FromGitter> <monouser7dig> I'd use shards build now that I know
<Groogy> a lot better
<FromGitter> <monouser7dig> shards build also updates the deps it seems ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ hierarchy works but is actually a bit noise if you ask me [https://gitter.im/crystal-lang/crystal?at=59d62e4ae44c43700af8cce8]
<Groogy> I only see array?
<FromGitter> <Rinkana> You can filter out stdlib classes i think
<FromGitter> <monouser7dig> @rx14 https://crystal-lang.org/docs/using_the_compiler/ shards build should be mentioned here otherwise sure, nobody knows
<RX14> shards build shouldnt update the deps, it'll install the versions in the shards.lock
<RX14> also shards != the compiler
<FromGitter> <monouser7dig> but the compiler section was were I looked when I wanted to compile the thing
<RX14> well it does tell you how to compile the thing
<FromGitter> <monouser7dig> filtering out those would be very good and also omitting class variables would be a good option
<FromGitter> <monouser7dig> yeah but not using shards which according to you is the preferred way
<RX14> we probably should have a section on shards and dependencies
<Groogy> aaaand someone modified the engine... queue half an hour compile time :(
<RX14> but it won't be in there
<FromGitter> <monouser7dig> also run --release works but is not mentioned, but I tried it because I trief enter because of you and it is actually great it works, but could be documented in there
<FromGitter> <monouser7dig> okay just saying what I think is the reason nobody uses it
<RX14> the reason is we dont mention shards in the guide lol
<FromGitter> <Rinkana> Groogy, no partial compiling for the engine?
<FromGitter> <monouser7dig> I like how crystal init set ups a readme but I think there is opportunity to also make a class hierarchy in there cause that is what I really miss in most GitHub projects, a good overview of what is going on/ interaction (homebrew *cough*)
<Groogy> a bunch of headers really badly included
<Groogy> and bad dependencies because of laziness
<Groogy> so if oyu touch the wrong thing you can get stuck in long time of compilation time
<FromGitter> <Rinkana> :/
<Groogy> also to note I am sitting on an older engine, about 3 generations behind the bleeding edge
<Groogy> Our games live way too long :(
<Papierkorb_> How old school
<FromGitter> <Rinkana> Well, that might also be a good thing.
<Groogy> I mean it is great, people like what we do so they keep buying more stuff, we get time to put better polish on things and improve things
<Groogy> but you still sit and look longingly on the other teams
<Groogy> ;D
rohitpaulk has quit [Ping timeout: 255 seconds]
undy1ng has joined #crystal-lang
<FromGitter> <monouser7dig> @rx14 about `shards build`, the command itself is quite weird given that shards is not a build system but just a dependency manager and as I've read somewhere it never will be a build system, crystal build would certainly make more sense IMO, but crystal deps which is shards install is supposed to be discontinued, this makes the build situation more confusing though
<RX14> it's in shards because it's specified in shards.yml
<RX14> crystal itself will never read a shards.yml
<RX14> it's a basic build system
<RX14> but what it doesn't do it have dependencies
<Groogy> yeah technically it becomes a build system as in it can read a config file on how to build your project
<RX14> the vow not to make shards a build system is a vow not to overcomplciate it to have things depending on each other
<Groogy> it woul be nice with some more stuff like "oh move generated executable here"
<Groogy> or "launch executable from this work environment"
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> in the future
<Groogy> right now I do that with a bash script
<RX14> all shards build can do is crystal build <you choose>.cr -O bin/<you choose>
<RX14> Groogy, we only ever want to compile into the bin dir
<Groogy> yeah but crystal doesn't let you decide a work environment I think
<FromGitter> <monouser7dig> or just have it check the git repo for last modification date (not timestamp like make) which is basic for a build system, otherwise you'd use make build system to build using shards build system which is a bit...
<RX14> what do you mean work environment
<Groogy> I want to run the executable in /dist (where I put resources such like script, shaders, models etc.)
<RX14> if you have advanced needs you should use make
<Groogy> dist standing for "distributable" or some such :P
<RX14> or something similar
<Groogy> Cmake I guess
<Groogy> yeah just been lazy to deal with that
<RX14> we're not overcomplicating shards
<RX14> Groogy, make is usually fine for crystal because it doesn't really have the requirements for all sorts of crazy stuff
<RX14> and a lot of the complexity for a truly-portable makefile ends up in the macro system
<Groogy> well cmake would let me generate it for potentially any platform
<RX14> for a purely-crystal project, makefile usually works great
<RX14> if you're mixing C/C++ and crystal
<RX14> well then cmake sure
<Groogy> hmmm
<RX14> makefiles are already cross-platform
<Groogy> so what do you use to generate your make files?
<RX14> crystal is already cross-platform
<RX14> Groogy, a text editor
<RX14> they usually fit on 1 page
<Groogy> Hmmm I guess
<RX14> like most makefiles for crystal are < 80 lines
<RX14> even the crazy one for the compiler is only like 300
<FromGitter> <monouser7dig> does shards build have flags like --release or run as well? or does it just always build in release mode and that is it?
<RX14> and written by hand
<RX14> @monouser7dig any flags to shards build get forwarded to the compiler
<RX14> Groogy, i lied
<RX14> 134 lines for the crystal makefile
<RX14> and that includes finding llvm-config
<RX14> compiling compiler/std/all specs
<RX14> running them
<RX14> loads of options
<RX14> and even a help system lol
<RX14> generating makefiles is an artifact of C/C++
<Groogy> ugh but all this boring stuff :(
<Groogy> will have ot make it eventually
<RX14> make is easy though :)
<RX14> and useful and somewhat fun
<Groogy> or wait yeah boleite don't need it, it is my own project that needs it
alex`` has quit [Ping timeout: 240 seconds]
<Groogy> though boleite could potentially provide a template
<crystal-gh> [crystal] bcardiff closed pull request #5072: Change Time constructor to have `nanosecond` & `kind` as named argument (master...time-new-milli-nano) https://git.io/vdWEf
<FromGitter> <monouser7dig> if the shards.yml does not include a target which it does not by default then shards build does not build anything? shards build in bolete passes and does not produce anything, and it gives `Installing lib_gl (0.1.4)` every single time again which is strange
<FromGitter> <monouser7dig> lib_ql is in the lib so it does not make sense that is says installing every time 😟
<Groogy> boleite is a framework so not supposed to be done alone
<RX14> shards build with no targets == shards install
<RX14> which also happens to be the same as shards with no arguments
<z64> monouser7dig, this is usually because that library version has a version mismatch in their shards.yml, so the dep check always fails
<FromGitter> <monouser7dig> though the message would say `missmatch` in that case ok 👍 alright rx14 I' ll write that down
<z64> if you run `shards list` you'll probably see that lib has a version listed in the () that does not match their latest tag
undy1ng has quit [Ping timeout: 240 seconds]
<FromGitter> <monouser7dig> ok so why is that an issue? the shards lock is supposed to have some version in there which shards install should respect? the reason for shards lock was that you do not use a new library unless explicitly specified?
<z64> because it checks the shard.yml of your deps to see if it satisfies the version rule in your apps shard.yml, and then decides whether it needs to update
<z64> v0.3.3, but they put 0.1.0 in shard.yml, so shards always thinks it has an old version checked out
<z64> (if your rule was `version: ~> 0.3.3` for ex in *your* shard.yml)
claudiuinberlin has joined #crystal-lang
<FromGitter> <monouser7dig> > **<z64>** see this for example https://github.com/jeromegn/kilt/blob/v0.3.3/shard.yml#L2 ⏎ that is the version of the app, but not the dep?
<z64> i mean that, if your app depended on kilt ~> 0.3.3, you would see this same "bug" because their shard.yml was wrong
<z64> is that lib_gl on github?
<FromGitter> <monouser7dig> so the shard of lib_gl is wrong? if lib_gl currently is 100.123 shards should still install 0.1.4 cause that is in the shards.lock
<FromGitter> <Rinkana> Can i get the current parent class?
<Papierkorb_> Rinkana `{{ @type.superclass }}`
<FromGitter> <monouser7dig> https://github.com/jellymann/crystal_lib_gl maybe the naming in the shards.yml is missing the crystal_ and thus is somehow confused
<FromGitter> <monouser7dig> actually it is not missing
<z64> v0.1.4 but shards says v0.1.0
<FromGitter> <Rinkana> @Papierkorb_ so not without macro's?
<travis-ci> crystal-lang/crystal#bd55733 (master - Change Time constructor to have `nanosecond` & `kind` as named argument (#5072)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/283695874
<z64> `shards build` runs `check` and `install` if the dependency check fails https://github.com/crystal-lang/shards/blob/master/src/cli.cr#L83-L87
<z64> which is always will for lib_gl
<FromGitter> <monouser7dig> so does shards use the tag name in github to fetch but the shard.yml in the fetched repo to check?
<Papierkorb_> Rinkana, types are compile-time constructs
<z64> monouser7dig yes it uses the tag to fetch, but uses the shard.yml version to check if dependencies are correct
<FromGitter> <monouser7dig> hmmm ... thanks for the long explanation
<z64> no problem. its annoying lol :) you can edit lib_gl in your `lib/` folder and see that it fixes this. you can fork lib_gl and depend on your own fork if it bothers you, and open an issue on lib_gl
<z64> a spec can help catch these little mistakes too, for example https://github.com/meew0/discordcr/blob/master/spec/discordcr_spec.cr#L23-L28
<FromGitter> <monouser7dig> I'll let him know Kindly, he has a few libs thus I think it is worth it
<Groogy> huh wut?
<Groogy> also on the jellyman gl I need to replace it to be on my pull request, he seems inactive
<Groogy> will do when I get home
<FromGitter> <Rinkana> Well would it matter? Because it seems that the libs won't change much anympre
<Groogy> or wait it was glfw3 binding that was broken
<FromGitter> <Rinkana> You can use mine but they are incomplete :P
<Groogy> an enum is misspelled so
<Groogy> and yeah should create a new libgl and libglfw since jellyman seems to be inactive anyway for any problems that needs to be fixed, like versioning etc.
<FromGitter> <Rinkana> The GL can be generated so it's not that much of a hassle
<FromGitter> <Rinkana> I do like the gl.xml
<FromGitter> <Rinkana> And vk.xml
<Groogy> I'm waiting for Papierkorb_ to finish his bindgen for C bindings
<Groogy> thne I'll maintain a live GLFW3, OpenGL, freeimage and Freetype bindings
<FromGitter> <monouser7dig> contrib oct 2017? inactive?
<Groogy> no the link I gave was my pull request
<Groogy> his repos are a year old
<FromGitter> <monouser7dig> yes but his profile, he certainly is alive
<Groogy> ah
<Groogy> then he is just ignoring me :(
<FromGitter> <Rinkana> Playing hard-to-get :P
<Groogy> meh when I can just auto generate the bindings I'll take care of it :P
<FromGitter> <Rinkana> Well you already can :P Just not for GLFW
<FromGitter> <monouser7dig> I see when you do `crystal init app foo` the shards yml has a target, nice 👍
undy1ng has joined #crystal-lang
<Papierkorb_> Groogy: https://github.com/Papierkorb/bindgen/blob/master/TEMPLATE.yml#L106 The type configuration system will get more clever next. Also, I want it to detect when it can directly bind to a function, to not emit any C++ wrapper code in that case. That should be possible for many/most/all C functions
<Papierkorb_> Except if you configure C++-world conversions of course
<Papierkorb_> C callbacks are missing atm. Also a feature I'm looking forward to.
rohitpaulk has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
<FromGitter> <monouser7dig> does someone have a nice testing lib? rake drives me out of my head with it's pseudo english, or should I just get used to it?
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <bew> The default spec lib is not sufficient fo you? @monouser7dig
<FromGitter> <monouser7dig> sorry ruby miss-mixture, meant to say spec, I am sure it is sufficient for me cause it is sufficient for you I just do not like how they are written, I used some simple tests in ruby `< MiniTest::Unit::TestCase` which had simple assertions e.g.
<FromGitter> <pawandubey> @monouser7dig https://github.com/ysbaddaden/minitest.cr
<FromGitter> <monouser7dig> aaaah 😋 very good
<Groogy> monouser7dig you should use mine ;D
<Groogy> It's not TDD or unit tests though
<FromGitter> <monouser7dig> r?.must_equal(" this `must_equal` is just .... it tries to hard to be something which it is not 😄 ⏎ ⏎ yeah actually because of the name and because Groogy included your lib I looked at it ⏎ ⏎ 1) is there a way to turn it on/ off like using a flag? [https://gitter.im/crystal-lang/crystal?at=59d646e2bbbf9f1a3827365c]
<FromGitter> <monouser7dig> -D i am sorry 😄
<Groogy> crystal clear? yeah with DISABLE_CONTRACTS
<Groogy> or you meant with minitests?
<FromGitter> <monouser7dig> crystal-clear, ⏎ I had minitests just in a separate file
<Groogy> you can also exclude specific methods to be ignored by the system if they are performance intensive etc. as well
<Groogy> I had at start that --release would turn off contracts, but I moved it to its own flag instead
<FromGitter> <monouser7dig> I was a bit blinded, did not realize you had crystal clear and boleite lol 😄 ⏎ ⏎ if I had to guess, I'd say it is possible to define a macro in the main programm that sets the D flag if --released is passed
<Groogy> yeah
<Groogy> CrystalClear::Config::IS_ENABLED must be false
<Groogy> that will disable everything
snsei has joined #crystal-lang
<FromGitter> <monouser7dig> {% if flag?(:release) %} ⏎ CrystalClear::Config::IS_ENABLED = false ⏎ {%end%}
<Groogy> though IS_ENABLED is a constant so don't think it will let you set it
<Groogy> I might need to remake the ocnfig module a bit
<Groogy> but it should be possible yes :)
<FromGitter> <monouser7dig> yes ok but the flag works for the time being
<Groogy> yeah
<FromGitter> <monouser7dig> as I've learned today flags are passed when doing shards build 😋
<Groogy> would be nice with a kind of setflag(:something, true) macro which lets you set flags from code
alex`` has joined #crystal-lang
<FromGitter> <monouser7dig> like meta meta macro ✨
<Groogy> well I already have macros that change macros :P
<Groogy> so not a problem ;D
<FromGitter> <monouser7dig> in the macro std doc, am I missing something if I say that >50% is just boilerplate that says "you can write normal crystal code like arrays[1]"? would it make sense to condense this down to macro specific things like flag?, superclass, instate variables ...?
<Papierkorb> It's not normal crystal code, it just "happens" to look like crystal for the most part
rohitpaulk has joined #crystal-lang
<Groogy> It uses a different set of types as well
<FromGitter> <monouser7dig> ? if I write ⏎ a = @type.filename ⏎ p a[0] ⏎ seems like ordinary crystal but I seem to miss something, ⏎ of course the @types are AST nodes but part from that [https://gitter.im/crystal-lang/crystal?at=59d64d5cb59d55b823784fa5]
<Groogy> anything in here is what you can do: https://crystal-lang.org/api/0.23.1/Crystal/Macros.html
<Groogy> I think it is normal crystal since the compiler is crystal as well
<Groogy> but it has certain limitations and changes
<Groogy> like you don't have to care about type at all pretty much
<Groogy> or well in the same degree as you would in normal code
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <monouser7dig> yes but the submodules are just really noisy and hard to parse 😄
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <monouser7dig> like ArrayLiteral is just... okay I know what an array is and if it is not an array I'd just like to know the diff ⏎ (and if I read Block (https://crystal-lang.org/api/0.23.1/Crystal/Macros/Block.html), an example would help, not saying I need it right now but it would make usage easier) but as I understand macros are still WIP so this may be totally expected
claudiuinberlin has joined #crystal-lang
<Groogy> most of this didn't exist I think when I started using Crystal
<Groogy> but eh Block holds the expressions of the block given to the macro
<Groogy> if I remember correctly
<Groogy> dang it I lost it ubt I had an example where a guy used blocks in a macro to create his own custom @[Attributes]
<Groogy> :)
<FromGitter> <monouser7dig> something like this would be indeed be an excellent example in such a page, like when I briefly looked at node.js they had tons of such examples/ recommendations even pro/ cons
<Groogy> eh essentially what he did was yield.body.stringify.do_stuff_to_string
<Groogy> I as well do a bunch of filthy hacks like that :P
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> How do I handle this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59d65401e44c43700af9a644]
<FromGitter> <bararchy> ```@headers : Hash(String, String).new # wont work```
<Papierkorb> @headers = {} of String => String
rohitpaulk has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] j8r opened pull request #5080: Integrate the if conditions in the case expressions (master...if-clean) https://git.io/vdRIQ
<Groogy> time to head home, cya!
<FromGitter> <monouser7dig> why does ⏎ `foo = [] of Int` work ⏎ but ⏎ `foo : Array(Int) = []` ⏎ not ... [https://gitter.im/crystal-lang/crystal?at=59d6572c177fb9fe7e41ea52]
<Groogy> because it doesn't know the type of the []
<Groogy> if you do [] of Int
<Groogy> it should work
<FromGitter> <imonmyown> what about `Array(Int).new`?
<FromGitter> <monouser7dig> I told him I'd want Array(Int) so I thought [] was an array and crystal would figure it has no Ints
<FromGitter> <monouser7dig> yes Array(Int).new works, I was just wondering
<FromGitter> <monouser7dig> nevermind ⏎ ⏎ foo : Array(Int32) ⏎ works ⏎ one has to omit the empty [] [https://gitter.im/crystal-lang/crystal?at=59d65954bbbf9f1a3827a1de]
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <imonmyown> To me [] sounds like a request to create a new array
<FromGitter> <monouser7dig> it is an empty array and foo : Array(Int32) = [] to me is the same as foo : Array(Int32) that is why I am surprised crystal did not understand 😄
<FromGitter> <Sija> `[]` ain't valid Crystal code
<FromGitter> <Sija> you always need to provide the type for it, same goes for hash
<FromGitter> <Sija> `[] of MyType` && `{} of MyType => MyType`
<FromGitter> <Sija> vs `Array(MyType).new` && `Hash(MyType, MyType).new`
undy1ng has quit [Ping timeout: 240 seconds]
<FromGitter> <monouser7dig> you are right, it does not work for assignments after initialization either, still find it a bit weird ⏎ and actually made a dumb mistake because the error message said "use of ElementType" and I thought that was a crystal thing so my code read ⏎ foo : Array(Int32) = [] of ElementType and I was wondering why it would not compile 😄
undy1ng has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <georgeu2000> @bew Thanks! ⏎ ⏎ > there is class_property!
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
undy1ng has quit [Ping timeout: 264 seconds]
sz0 has joined #crystal-lang
alex`` has quit [Read error: No route to host]
undy1ng has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
undy1ng has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 258 seconds]
<FromGitter> <georgeu2000> Does Crystal support `class << self` ?
<FromGitter> <georgeu2000> Or is there another way of declaring all class methods?
<FromGitter> <mixflame> @george I would believe not because there isn't metaprogramming, but check out Macros from crystal
<FromGitter> <bew> @georgeu2000 can you explain what this does and how to use it? (in ruby)
rohitpaulk has joined #crystal-lang
<FromGitter> <georgeu2000> Sure. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ All methods defined within `class << self` are class methods. ... [https://gitter.im/crystal-lang/crystal?at=59d66feb614889d4757c66b0]
<FromGitter> <monouser7dig> class <<< self ist just like ⏎ ⏎ class foo ⏎ def self.bar ⏎ end ... [https://gitter.im/crystal-lang/crystal?at=59d66ffb614889d4757c66e5]
<FromGitter> <monouser7dig> you can use self.xyz in crystal ⏎ ⏎ using modules you can use extend to include a macro as class methods ⏎ https://crystal-lang.org/docs/syntax_and_semantics/modules.html [https://gitter.im/crystal-lang/crystal?at=59d67096b59d55b823791009]
<FromGitter> <bew> @georgeu2000 ˆ
<FromGitter> <monouser7dig> ^^
Groogy has quit [Disconnected by services]
Groogy2 is now known as Groogy
Groogy_ has joined #crystal-lang
<FromGitter> <monouser7dig> I believe in ruby der was even a third way of doing this #size,length,count :D ⏎ ⏎ @georgeu2000 maybe read this / skim through ⏎ https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists [https://gitter.im/crystal-lang/crystal?at=59d6729a177fb9fe7e428165]
<bmcginty> Weird thing I'm finding with sockets in crystal (probably a libevent issue?). If you want to detect if a socket doesn't have any data pending to read, you set a 1 microsecond timeout and try to read from the socket. For some reason, this fails with Crystal's libevent code. I'm thinking that the libevent timer fires before libevent actually tries to read from the socket? But not sure.
<FromGitter> <monouser7dig> @Groogy in case you are still around ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ talking about macros and blocks and suitable example [https://gitter.im/crystal-lang/crystal?at=59d674bbb59d55b823792712]
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <Sija> @monouser7dig there’s `extend self` which is similar to `class << self`
<FromGitter> <georgeu2000> @bew - OK, I'll take a look. ⏎ ⏎ > using modules you can use extend to include a macro as class methods
<FromGitter> <georgeu2000> Thanks.
<Groogy> I just got home so yeah
<Groogy> though don't remember what I was supposed to do xD
<FromGitter> <monouser7dig> you were supposed to come up with a good example of using a block node in a macro 😄 though you were not actually supposed to do that, just said you read sth.
<FromGitter> <monouser7dig> extend self in ruby? or is this the beginning of ruby options in crystal?
<FromGitter> <georgeu2000> @monouser7dig - Yes, that's a pretty helpful doc. Thanks. ⏎ ⏎ > https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists
<FromGitter> <Sija> @monouser7dig no, that’s Crystal :)
<FromGitter> <monouser7dig> so is it similar or the same?
<FromGitter> <Sija> similar, since it doesn’t work for classes, just modules
<FromGitter> <Sija> IIRC in Ruby you can use it with classes too
<FromGitter> <Sija> and with classes https://play.crystal-lang.org/#/r/2uvt
<FromGitter> <monouser7dig> this is actually surprising cause the extend already defines the method as a "Module method" which can be called Fooable.foo? and then you extend Foo so the method is kind of self << self
<FromGitter> <monouser7dig> if you include Fooable in Foo it does not work though
<FromGitter> <monouser7dig> what I mean: ⏎ ⏎ if you extend Foo with Fooable, it does not matter if you extend self in Fooable, it both works the same
<FromGitter> <Sija> you’re right `extend self` isn’t needed in the second example
<FromGitter> <monouser7dig> but if you extend self and then include, it does not work, although I would have expected it to work
<FromGitter> <monouser7dig> but maybe that is just module != class and thus extend self in a module is not the same as extend self in a class
<FromGitter> <Sija> works for me https://play.crystal-lang.org/#/r/2uw9
<FromGitter> <Sija> `extend self` is still pointless
<FromGitter> <Sija> but nvm ;)
<FromGitter> <monouser7dig> yes it work because now you called it on the instance level but if you write extend self in the module you could expect it to work an a class level in the Foo class
<FromGitter> <monouser7dig> nvm yes 😄
<FromGitter> <Sija> perhaps it’s a good issue to put on a tracker ;)
<FromGitter> <monouser7dig> I am not sure it is an issue
<FromGitter> <monouser7dig> already bothered them with some stuff 😄 https://github.com/crystal-lang/crystal/issues/5074
<FromGitter> <Sija> :D
<FromGitter> <Sija> touching established standards is always tricky biz
<FromGitter> <monouser7dig> did you know there is `crystal tool format --check`? just reading the slides from some meet up rx14 had in some random thread 😄
<FromGitter> <Sija> yep, it our code-quality CI guardian - https://github.com/crystal-lang/crystal/blob/master/bin/ci#L89 ;)
<FromGitter> <monouser7dig> I think there are options for the other tools as well but hard to find (propably just source code)
<FromGitter> <monouser7dig> e.g. hierarchy as json should work somehow I think
<FromGitter> <monouser7dig> is it right to support this to the foreign repo which handles these crystal tools? (brackets color missmatch)
<FromGitter> <monouser7dig> > you’re right `extend self` isn’t needed in the second example ⏎ ⏎ like, do you know c function pointer? where you can have a fun_p and do ⏎ ⏎ fun_p(var) ... [https://gitter.im/crystal-lang/crystal?at=59d67dd1bbbf9f1a38286322]
<FromGitter> <monouser7dig> hm markdown screwed me ⏎ `fun_p(var); *fun_p(var); *****fun_p(var)`
<FromGitter> <Sija> yep, and Crystal has closures
<FromGitter> <monouser7dig> just about calling extend self more than needed but it still works 😄
<FromGitter> <Sija> :P
<FromGitter> <monouser7dig> what does a raw `new` do? ⏎ ⏎ ```class Kemal::RouteHandler ⏎ include HTTP::Handler ⏎ INSTANCE = new``` [https://gitter.im/crystal-lang/crystal?at=59d6818df7299e8f53b1ae0a]
claudiuinberlin has joined #crystal-lang
<FromGitter> <georgeu2000> ```code paste, see link``` ⏎ ⏎ I don't see the class of the error. How do I find out what class it is? [https://gitter.im/crystal-lang/crystal?at=59d681fcbac826f0543c75c2]
<FromGitter> <Sija> @monouser7dig it’s calling `self.new` (`Kemal::RouteHandler.new` actually)
<FromGitter> <Sija> `Kemal::RouteHandler::INSTANCE` acts as singleton instance
<FromGitter> <monouser7dig> aaaah interesting !
<Groogy> @bew you here?
<FromGitter> <bew> very short time, yes
<Groogy> how was it you said I could improve def \{{`contract_ensures_` name.stringify).id}}(return_value, \{{args.splat}}) ??
<Groogy> or eh ops that's me already trying but failing
<Groogy> def \{{("contract_ensures_" + name.stringify).id}}(return_value, \{{args.splat}})
<Groogy> that
<FromGitter> <bew> `contract_ensures_\{{name}}(return_value, \{{args.splat}})` iirc
<Groogy> oooh you mean not the ` actual in code
<Groogy> I am dumb
<Groogy> thought you meant a syntax to declare MacroId
<FromGitter> <monouser7dig> > `Kemal::RouteHandler::INSTANCE` acts as singleton instance
<FromGitter> <monouser7dig> https://play.crystal-lang.org/#/r/2ux4
<FromGitter> <monouser7dig> class * but still two instances
<FromGitter> <bew> Groogy, huh? I use ` to display code in gitter properly
<FromGitter> <bew> but don't put them in the actual code
<FromGitter> <sdogruyol> @monouser7dig what?
<FromGitter> <Sija> @monouser7dig wrong, it’s just `nil` everywhere
<FromGitter> <monouser7dig> Singleton means only one can exist?
<FromGitter> <Sija> since your overloaded `self.new` returns `nil`
<FromGitter> <Sija> yep
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <monouser7dig> the Kemal guys have their own initializer as well and afaik initialize is the same as self.new?
<FromGitter> <monouser7dig> regardless without init or self.new it still works
<FromGitter> <bew> it means notmhing to hve a initialize of new in a module
<FromGitter> <monouser7dig> yes typo, I meant class * still does not work as a singelton
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <sdogruyol> @monouser7dig if you use .new it won't
<Groogy> yeah just it only shows ` here on IRC
<Groogy> so I got confused :P
<FromGitter> <monouser7dig> @sija did you mean INSTANCE is a singleton or did you mean Kemal::RouteHandler is the singleton? probably I misunderstood and though Kemal::RouteHandler
<FromGitter> <Sija> i meant that `Kemal::RouteHandler::INSTANCE` acts as a singleton object, but nothing in `self.new` prevents it from being constructed otherwise
<FromGitter> <Sija> `Kemal::RouteHandler.new !== Kemal::RouteHandler.new`
<FromGitter> <Sija> but
<FromGitter> <Sija> `Kemal::RouteHandler::INSTANCE == Kemal::RouteHandler::INSTANCE`
<FromGitter> <Sija> since it’s created already during class initialization
<FromGitter> <monouser7dig> wouldn't it be better to somehow put the restriction on Kemal::RouteHandler itself? is that possible?
<FromGitter> <bew> You can have a private constructor
undy1ng has joined #crystal-lang
<FromGitter> <monouser7dig> okay, astrite has this construct here https://github.com/crystal-lang/crystal/issues/718#issuecomment-107200289 is the .instance method in any way special?
<Papierkorb> No
<FromGitter> <monouser7dig> okay!
claudiuinberlin has joined #crystal-lang
ShalokShalom_ is now known as ShalokShalom
<crystal-gh> [crystal] Sija opened pull request #5081: Document ASTNode#symbolize (master...macros-astnode-stringify-docs) https://git.io/vdRoA
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> huh just realized, if you provide default arguments, the args.splat will also splat the default arg
<Groogy> I'm dumb
<Groogy> need to figure out how to not splat the types/default values etc but only the names in the arg list
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<FromGitter> <monouser7dig> what does crystal spec actually call? can you modify/ trick it into working with something else than Crystal::spec?
<FromGitter> <georgeu2000> Is it possible to set a variable in a before block in Spec?
<FromGitter> <georgeu2000> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59d69b0fbac826f0543cfc0c]
<Groogy> hmmmm I think someone told me that assert was added to crystal?
<FromGitter> <georgeu2000> I am using Expect shard.
<RX14> no there was an issue Groogy
<RX14> but it seems to not be going anywhere
<RX14> dont expect it
<FromGitter> <georgeu2000> Expect: https://github.com/dukex/expect.cr
<RX14> @georgeu2000 you can't set a variable in before
<FromGitter> <georgeu2000> OK thanks.
<RX14> you're expected to keep all state inside the spec
<RX14> and use helper methods
<RX14> instead of keeping global state
<RX14> which is bad
<FromGitter> <georgeu2000> Can you provide an example?
<FromGitter> <monouser7dig> would assert be the relief to not use `.should be_false` just 'assert one, two`?
<FromGitter> <georgeu2000> Or documentation? @RX14
<RX14> depends what you're trying to do
<oprypin> monouser7dig, minds poisoned by Ruby don't see that as an advantage
<RX14> oprypin, they do have some valid points no matter how much i'd prefer assert
<oprypin> no they don't lol
<oprypin> monouser7dig, may be interested to see https://github.com/crystal-lang/crystal/issues/3095
<RX14> oprypin, did you ever measure compile-time performance with using a simple assert?
<RX14> with just left and right values printed?
<RX14> i don't like assert outside spec though
claudiuinberlin has joined #crystal-lang
<Groogy> RX14 thanks
<Groogy> then I am adding it back to my library
claudiuinberlin has quit [Client Quit]
<FromGitter> <asterite> You can use spec2 or minitest for testing, the built-in spec is very simple and dumb (I wish we could improve it, but the language isn't capable of that)
<FromGitter> <elorest> Other than `before` being global I’m mostly happy with the built in spec.
<RX14> @asterite asking people to use spec2 or minitest feels wrong
<RX14> we should offer a testing library for 99.5% of projects in the stdlib
<FromGitter> <georgeu2000> Is it possible to declare a hash of strings of arbitrary depth?
<Groogy> @asterite you should add contracts like C++ is
<Groogy> hint hint, nudge nudge
<oprypin> :(
<FromGitter> <monouser7dig> thanks Sija I like the debug output at least for relatively simple and math centered problems which I had to deal with quite a bit but generally I say, I want to write tests in the main language and the less DSL it is the better
<RX14> Groogy, i doubt that'll happen
<RX14> and if it's proposed i'd probably be on the other side of the argument to you
<RX14> @asterite assert is inherently simpler and dumber yet more powerful than our current spec system
kubaxvx__ has quit [Quit: WeeChat 1.6]
<oprypin> i just looked at the issue and it's over a year ago. this year felt about 3 times shorter than the previous one.
<Groogy> and there asserts done
<FromGitter> <monouser7dig> Groogery contracts? like you can pull out some meaningful invariance out of every function? that'd be impressive ✨
<Groogy> you've already looked at crystal clear :P
<Groogy> though I was more jesting on the horrible syntax C++17 is planned to have for contracts
<FromGitter> <monouser7dig> fair point 😄
<Groogy> anyway off to bed, night! o/
<FromGitter> <monouser7dig> question about files: I used to rewrite some bash scripts in ruby cause I hate to write bash, File utils in ruby were extremely bogus at times though so I had to resort to `system `do_bash_cmd`` anyway, do you know if crystal is supposed to handle this well? I read those issues were not uncommon in ruby
<oprypin> monouser7dig, yeah that probably won't be a pleasant experience tbh
<FromGitter> <monouser7dig> sigh
<FromGitter> <asterite> The missing thing from spec is not assert or power assert, it's let and before(:each)
<FromGitter> <elorest> Yeah
<Groogy> though if you are doing defensive programming and not just tdd then asserts are a pretty good tool to not just let everything fail silently
<RX14> @asterite what usecase does let really have though?
<RX14> i think that helper methods are much clearer
<RX14> instead of let you just write a getter
<FromGitter> <asterite> Well, in "real world" applications where you need to create a bunch of models, setup is useful. But I always managed to use helper methods to do things, or even invoke helper methods that define test cases (like in the lexer, parser, markdown, etc.). So I guess it just depends on what you are used to
<oprypin> im definitely not used to a crummy DSL, tell you that much
<RX14> @asterite even with testing my b2 client against real b2, which required cleanup, it wasn't really a big deal.
<FromGitter> <monouser7dig> > So I guess it just depends on what you are used to ⏎ ⏎ I mean Jonathan Blow managed to write a compiler that kind of works without test afaik 😄 ⏎ ⏎ oprypin lol 😄 [https://gitter.im/crystal-lang/crystal?at=59d6a35d210ac26920b0d35f]
<FromGitter> <asterite> RX14: Cool! Yes, I tend to do something like that and it works and it's clean :-)
<FromGitter> <asterite> I wish I could erase the memories from playing Braid or The Witness and play them again :-P
<RX14> i never needed or wanted or thought we should have more than the "it" dsl
<RX14> it's the .should stuff i think is bad
<oprypin> but "it" is also horrible
<RX14> it's fine
<oprypin> They Don't Think It Be Like It Is But It Do
<RX14> why do you think it's bad?
<oprypin> because DSLs are bad mkay
<RX14> uhh
<oprypin> it just looks silly
<RX14> ok
<Groogy> that's not a valid argument.... really
<RX14> i really disagree
<Groogy> I mean I don't do specs but my reasons are more tangible as in other things
<Groogy> like I am lazy, it doesn't fit my use cases, etc.
<RX14> it specs read like english and their semantics are simple
<RX14> i don't see whats bad about them
<FromGitter> <monouser7dig> what do you mean with `it specs`? two chars are no big deal but you still have .should be_false?
<FromGitter> <asterite> it "works" for some
<FromGitter> <asterite> it "stinks" for others
<RX14> @monouser7dig the spec library is 2 parts: the spec harness, which is the "outer" part of specs which calls your code to test stuff
<RX14> and the spec assertions
<RX14> which raise exceptions when what you get isn't what you expect
<RX14> @asterite judging by the adoption, it works for a lot more people than not
<RX14> most libraries and shards use it
<RX14> only a few ditch it
<FromGitter> <monouser7dig> because ditching is harder than. not ditching and ruby people all do it anyway
<RX14> i like the harness but dislike the assertions
<RX14> is all
<Groogy> reuqires arg.more_contracts ;D
<Groogy> anyway bye
<FromGitter> <monouser7dig> given how close crystal is to ruby syntax, are you actually willing to break this workflow for ruby users? I mean I do not care about keeping it but just wondering if it may actually cause grief
<Papierkorb> The last thing I want is asserts only. But in general, Crystal isn't Ruby monouser7dig. Compatibility to it isn't a goal.
<RX14> Papierkorb, i forget, why are you against asserts?
<FromGitter> <monouser7dig> ok good
<Papierkorb> I don't like their look.
<Papierkorb> I want that forced deviation from normal code.
<RX14> to me, expect is the deviation from normal code
<RX14> with assert, you simply prefix normal code with assert
<Papierkorb> We've been through this already
<RX14> instead of expect where you have to write ina weird expect DSL
<RX14> it doesn't mean i understand it any more Papierkorb
<Papierkorb> I *want* that the developer has to stop for a second and not just copy/paste random conditions from the code
<Papierkorb> This may be the only instance where I'll ever advocate for a context switch
<Papierkorb> (in the developers brain)
<RX14> a sufficiently lazy developer will just use .should be_true
<RX14> i don't think it's that big of a deal
<Papierkorb> Correct, but that shit is easy to spot
<RX14> that is a fair point, but i don't think that optimizing the spec library for people who try to misuse it is a good idea
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vdR5F
<crystal-gh> crystal/master bdd038d Akzhan Abdulin: YAML/Time parsers/formatters now take in care nanoseconds (#5070)...
tybee[m] has joined #crystal-lang
<FromGitter> <imonmyown> Guys, arch-noob here, running into problems trying to install gnome. Any help?
<FromGitter> <imonmyown> Is gnome the right choice for experiments in GUI design lately?
<Groogy> I use gnome
<Groogy> though installing it was pretty much just sudo pacman -S gnome
<FromGitter> <imonmyown> could the problem be related that I did it from root?
<FromGitter> <imonmyown> When I run `mutter` or `gnome-shell` I get `Unsupported session type`
<Groogy> no idea I just followed the guide, installed a gnome + a diplay manager
<Groogy> and were done
<FromGitter> <monouser7dig> as arch cube maybe use antergos which is just arch with installer you get gnome as one option
<FromGitter> <monouser7dig> arch noob*
<travis-ci> crystal-lang/crystal#bdd038d (master - YAML/Time parsers/formatters now take in care nanoseconds (#5070)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/283920520
<FromGitter> <monouser7dig> who is working on crystalox? (https://www.redox-os.org) 😄
<Papierkorb> There have been at least three Crystal OS'es, counting my own unpublished one
<FromGitter> <imonmyown> @Papierkorb can you give links to them, I might add a voice to the choir sometime later :)
<FromGitter> <monouser7dig> 😄 how do they work without threads?
<Papierkorb> Crystal isn't good for system-level programming, or more precise: If you use Crystal, you'll want to have at least a minimal user-space (basic I/O and memory management) - So, building applications interacting with a kernel, including writing userland drivers in it, works fine. But Kernel-space is not fun without lot of work.
<Papierkorb> imonmyown, sorry, don't have anything handy >_>;
<FromGitter> <imonmyown> Is the standard library accessible for the (OS) programmers
<FromGitter> <georgeu2000> Given ⏎ ⏎ ```server = HTTP::Server.new( bind, port ) do | context |``` ⏎ ⏎ How can I create a context for testing purposes? [https://gitter.im/crystal-lang/crystal?at=59d6b2f6bac826f0543d7119]
<Papierkorb> imonmyown, As there is nothing that could provide the necessities the stdlib requires to function properly, no.
<FromGitter> <imonmyown> So I guess that must be the major hurdle
<Papierkorb> imonmyown, Everything in Crystal builds upon the kernel of your OS providing a user-space to you, stuff like process management, memory mangement, file access, etc.
<Papierkorb> If you are the kernel, there's no one providing that. You're to provide it, that's your job as kernel :)
<FromGitter> <imonmyown> Ha-ha, that's right :)
<FromGitter> <imonmyown> Which leaves us with C, I guess?
<Papierkorb> imonmyown, C and plenty others. Google "hobby os dev" or similar terms. Also, osdev.org
<Papierkorb> There's plenty of information. People have used pretty much any language to some degree (and various degrees of success) in or for kernel development
<Papierkorb> FreeBasic still takes the cake for me.
<FromGitter> <ezrast> @georgeu2000 Look in `http/server/context.cr` wherever your standard library is (it's in `/usr/lib/crystal` for me) to find what arguments `Context#initialize` takes.
<FromGitter> <imonmyown> @Papierkorb, will do, thanks for the leads
<FromGitter> <ezrast> You'll need to make `Request` and `Response` objects which are likewise defined in files under the `http` directory
<FromGitter> <imonmyown> However I tend to think that without proper threading support in crystal any such OS attempt won't have a bright future (if any future at all), which doesn't make those attempts attractive or worthwhile. So guys, please work hard to make threading in crystal finally possible! :)
<FromGitter> <monouser7dig> Papierkorb yeah was more of a potentially bad joke anyway
<FromGitter> <imonmyown> Well some crazy people (like me) might take it seriously enough :)
RickHull has joined #crystal-lang
<Papierkorb> imonmyown, the threading situation is *nothing* to do with kernel dev. There are no threads anyway. Except if you implement them. And then you have threads, no matter what the stdlib says
<FromGitter> <georgeu2000> @ezrast - OK, that's what I thought. Thanks.
<FromGitter> <imonmyown> @Papierkorb, well I have to admit that I didn't dig deep enough before I said what I said, touché :)
<FromGitter> <monouser7dig> once threads arrive, will all spawn do, channel stuff just work and be bit faster or is it expected to require a redo?
<FromGitter> <ezrast> Threads aren't replacing Fibers; they're different things.
<FromGitter> <monouser7dig> I know
<FromGitter> <monouser7dig> but thought fibers would be mapped onto threads
<FromGitter> <monouser7dig> instead of being scheduled on one thread
<FromGitter> <imonmyown> Rust is doing great job on futures
<FromGitter> <jwaldrip> Was there any chatter today on when the next release will be?
<FromGitter> <jwaldrip> I feel like a broken record... btw.