ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 248 seconds]
bmcginty has quit [Ping timeout: 248 seconds]
<FromGitter> <HCLarsen> Does operator overloading work in Crystal?
<FromGitter> <HCLarsen> Sorry, method overloading.
<FromGitter> <HCLarsen> As in, can I define the same method multiple time with different arguments?
<wazzeno> Yes, method overloading works.
<FromGitter> <HCLarsen> Thanks.
<FromGitter> <raydf> @georgeu2000 ⏎ try: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <raydf> sorry: ⏎ ⏎ ```code paste, see link``` []
gokmen has joined #crystal-lang
gokmen has quit [Client Quit]
<FromGitter> <Brusalk> I'm trying to build scry on Ubuntu 17.04, and I believe I've installed all the required devel dependencies, however upon building (specifically after/during Codegen (bc+obj), I'm getting a lot of undefined reference errors and it's failing to build. ⏎ ⏎ Has anyone run into this before or know what I can try and do to fix this? My google-fu is
<FromGitter> ... failing me and I'm not acquainted with llvm enough to know what is going wrong
<FromGitter> <Brusalk> I've been searching fruitlessly all day :(
chamar has joined #crystal-lang
<FromGitter> <georgeu2000> @raydf - Thanks for your help!
_whitelogger has joined #crystal-lang
bmcginty has joined #crystal-lang
DTZUZO has joined #crystal-lang
alex`` has joined #crystal-lang
danielpclark has joined #crystal-lang
<FromGitter> <Hellfire01> hi ! Simple question
<FromGitter> <Hellfire01> how do I declare an Array of Strings ?
<FromGitter> <Hellfire01> ex : ⏎ class Test ⏎ ⏎ ```getter String[]``` ⏎ ... []
<FromGitter> <Hellfire01> ( does not work )
<FromGitter> <Hellfire01> erf
<FromGitter> <Hellfire01> getter var : String[]
<FromGitter> <Hellfire01> ( better but does not work either )
<FromGitter> <tbrand> ```code paste, see link``` []
<FromGitter> <Hellfire01> thanks
<FromGitter> <Hellfire01> why does it not work if there is no initialize method in the class ?
<FromGitter> <tbrand> Since you have to guarantee the array is not nil, or you can decrare nullable varianble like `getter s1 : Array(String)?`
<FromGitter> <Hellfire01> so if I declare it as `getter s1 : Array(String)?` I allow it to take the nil value ?
<FromGitter> <tbrand> Yes
<FromGitter> <Hellfire01> thanks a lot
<FromGitter> <tbrand> 😄
<FromGitter> <Hellfire01> that also means that if i wish to avoid code redundancy i should declare the type in the initialize rather than in the getter ?
<FromGitter> <Hellfire01> *does that also
<FromGitter> <georgeu2000> You can also do `[] of String`, but not sure if it works for the above.
<FromGitter> <tbrand> Yap
<FromGitter> <tbrand> ```class Test ⏎ getter s1 = [] of String ⏎ end``` []
<FromGitter> <Hellfire01> you mean `String[]` ?
<FromGitter> <Hellfire01> oh
<FromGitter> <Hellfire01> is that a String Array declaration ?
<FromGitter> <georgeu2000> Yes.
<FromGitter> <Hellfire01> ( not familiar with the `of` keyword yet )
<FromGitter> <Hellfire01> 👍
<FromGitter> <georgeu2000> OMZ Crystal #1
<FromGitter> <Hellfire01> this is cool XD
<FromGitter> <tbrand> 👏
<FromGitter> <georgeu2000> When hit Hacker News it must have been crazy...
<FromGitter> <georgeu2000> I wonder how fast my Rack apps are:
<FromGitter> <ansarizafar> is there any shard available for sending push notifications?
<FromGitter> <tbrand> I'm waiting for your PR😆
<FromGitter> <georgeu2000> Sounds good but nobody used it...
<FromGitter> <georgeu2000> I'll look into it.
<FromGitter> <georgeu2000> Wow Roda is 10x faster than Rails.
<FromGitter> <georgeu2000> People are using Rails API but I don't like it...
<FromGitter> <georgeu2000> I wonder if Rails API is faster than your Rails benchmark...
<FromGitter> <georgeu2000> @ansarizafar - I don't see any.
<FromGitter> <georgeu2000> Also did not see on
<FromGitter> <georgeu2000> Those are the only 2 places I know to look.
wazzeno has quit [Quit: Leaving]
snsei has joined #crystal-lang
<FromGitter> <Brusalk> What file-context constants are there like `__FILE__` in Ruby?
<FromGitter> <tbrand> *FILE*
<FromGitter> <Brusalk> only file?
snsei has quit [Remote host closed the connection]
<FromGitter> <Brusalk> thanks @tbrand! :) Looks like there's also `__LINE__` and `__DIR__` in both macro and non-macro contexts. Also, `__END_LINE__` sometimes.
<FromGitter> <tbrand> 💯
<livcd> georgeu2000: performance...well
Papierkorb_ has joined #crystal-lang
<Papierkorb_> Morning
<FromGitter> <Rinkana> Morning :)
<FromGitter> <bararchy> Morning :)
Groogy has quit [Disconnected by services]
Groogy_ is now known as Groogy
<Groogy> Morning!
<FromGitter> <zyriuse75> morning all
Groogy2 has joined #crystal-lang
<FromGitter> <zyriuse75> how are you doing today ?
<Groogy> Happy since I confirmed for myself how damned fast Crystal is ^^
<Papierkorb_> Yeah was also pleased with your numbers. It being CPU bound is all the better for this case :)
claudiuinberlin has joined #crystal-lang
<FromGitter> <bararchy> I want to bind CUDA , if we are talking about CPU bound
<Papierkorb_> OpenCL *cough*
<FromGitter> <bararchy> Yeha :)
<FromGitter> <tbrand> Cool!
<Groogy> Yeah that I switched from debug to release gave like a doubling in speed
<Groogy> shows it was CPU bound
<Groogy> Bararchy usually when you say CPU bound and GPU bound you mean which component is throtthling the performance
<Groogy> i.e if you are doing super heavy OpenCL coding on the GPU, then you will become GPU bound :P
<FromGitter> <bararchy> Yeha, but having 2 Titan Nvidia cards with SLI, I guess it should perform a little better then my Xeon
<Groogy> Well yeah but in the example I showed, you wouldn't get any performance boost at all
<Papierkorb_> It's a bit infuriating how much data science relies on CUDA and not friggin OpenCL
<Groogy> I've never used OpenCL or CUDA
<Groogy> Never had time or oppertunity to play around with it
<Papierkorb_> If for nothing else, blockchain mining has proven that AMD cards can run circles around nvidias for such computations
<FromGitter> <bararchy> OpenCL caters for both though, W\E card you have
<FromGitter> <bararchy> I think Nvidia just got a better name when it comes to non-gaming work
<Papierkorb_> Which is another reason for OpenCL
<Papierkorb_> I mean I can test OpenCL code on my shitty netbook if needed
<FromGitter> <bararchy> cool, that's a better idea then, bind opencl
<FromGitter> <bararchy> :)
mark_66 has joined #crystal-lang
<FromGitter> <bararchy> I'll play with bindgen for it
<Groogy> closest I've come to this computing is like tesselation
<Papierkorb_> Oh and yesterday I found an interesting bug in the clang part. Let's hope it's in my code, and not clangs.
<FromGitter> <bararchy> :\
<FromGitter> <bararchy> I hope it's not in clang Oo
<Papierkorb_> Ah well, at least I found it by adding more specs to the project.
<Papierkorb_> Qt is starting to wane as primary testing target, weee
<FromGitter> <bararchy> wane as being les effective ?
<Papierkorb_> Efficiency isn't even that big deal, the test suite with integration tests needs more time than a full Qt run. Just is less fun to find bugs in 80k+ lines of C++ and Crystal code :P
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <Rinkana> Hmm, it seems that `ary = Array(String).new` is slower then `ary = [] of String`. I tought they would perform exacly the same
<Papierkorb_> code?
<FromGitter> <Rinkana> ```code paste, see link``` []
<FromGitter> <Rinkana> ```code paste, see link``` []
<Papierkorb_> Adding the item directly is faster in both cases, and makes the class 1.10x slower. Though even an empty literal is faster than an empty .new
<FromGitter> <Rinkana> Well this is just a benchmark. It's for what to use when defining classes: ⏎ ⏎ ```class Foo``` []
<FromGitter> <Rinkana> Its for defining classes to test: ⏎ ⏎ ```class Foo ⏎ property items = Array(String).new ⏎ end``` []
<FromGitter> <Rinkana> So the items are not known beforehand.
<FromGitter> <Rinkana> And the reason i wanted to test this is because i want consistancy in defining class vars. But in one of my classes i use `Deque`. And that does not have a literal. So i need to do `Deque(String).new`
<Papierkorb_> I doubt that you'll notice any difference in runtime
<Papierkorb_> The billions of temporary arrays generated by map and friends would worry me more
flaviodesousa has joined #crystal-lang
<FromGitter> <faustinoaq> > is the wildcard change already live? ⏎ ⏎ Papierkorb, I will implement this on next week, I'm a bit busy now 😅 I already open an issue here
<Papierkorb_> No problem, please keep me posted
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <faustinoaq> 👍
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
txdv has quit [Ping timeout: 258 seconds]
txdv has joined #crystal-lang
<Groogy> faustinoaq your part of the core team right?
<Groogy> or wait no you were on vs-code, nevermind that's where I remembered the name from
tzekid has joined #crystal-lang
<FromGitter> <bararchy> Papierkorb_ Only now I got that your lib can also Crystal to C++
<FromGitter> <bararchy> F**ing awsome !
<FromGitter> <yxhuvud> ugh, I can't use the generic type inside macros?
<FromGitter> <bararchy> @yxhuvud for a sec there I just saw "Linus" and was like OMG Linus Trovalds is here ?????, and then the gitter finsihed it's quirks and I got the full name :)
<FromGitter> <yxhuvud> sorry for not being that awesome
<FromGitter> <bararchy> you are still awsome :)
<FromGitter> <bararchy> ✨
claudiuinberlin has joined #crystal-lang
<Papierkorb_> bararchy, lol
tzekid_ has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tzekid has quit [Ping timeout: 255 seconds]
ShalokShalom has quit [Ping timeout: 258 seconds]
<Groogy> @yxhuvud yeah I know also bothered me
<Groogy> the Generic/Macros incompatibility is annoying
<FromGitter> <yxhuvud> I was able to work around it with some helper methods, but still somewhat silly to have to define methods like def rule_type; Rule(T); end
<FromGitter> <iambudi> Just found this db for OLAP. Looks interesting. Any crystal library to connect to this db ?
<Papierkorb_> Groogy: What incompat?
<FromGitter> <bararchy> Reserching a DPI solution for my current work place, all I can think about is would that be easy to bind using Ruby-FFI ?
<FromGitter> <bararchy> hate FFI
<Papierkorb_> Must be me, but I'd make it a habit to mess with DPI in any way possible if one was installed at my work if it's there to monitor employees
<Groogy> Papierkorb_ they exist kind if in seperate environments and can't interact
<Groogy> more than that Macros can generate code but it does not seem to be aware of stuff
<FromGitter> <bararchy> oh, it's for embedding in our software, it will be a part of a IPS\IDS soulution
<Groogy> it is especially noticeable in constants
<Papierkorb_> bararchy, ah so to defend against obvious crap from outside. that'd be fine.
<FromGitter> <bararchy> this IPS claims to be the new best ever super awsome IPS ever created in all universes, more reading ... uses suricaa and snort and builds around them ... hm...
<Papierkorb_> And then everyone just shoots login attempts at the shoddy php web application and brings it down without much traffic. Nice.
<FromGitter> <bararchy> XD
<crystal-gh> [crystal] straight-shoota opened pull request #5091: Fix be_nil expectation to use .nil? (
claudiuinberlin has joined #crystal-lang
<FromGitter> <Rinkana> Is DPI in such case legal?
DTZUZO has joined #crystal-lang
<Papierkorb_> To inspect traffic coming from the outside? Usually yes, why not?
<Papierkorb_> To monitor employees? Highly local legal issue
<FromGitter> <Rinkana> Yeah, because here it's illegal to monitor employees in such way
<Papierkorb_> "here"?
<FromGitter> <Rinkana> Netherlands
<Papierkorb_> Not sure how it is in Germany exactly, but if it's allowed, it's rather restrictive
<FromGitter> <Rinkana> Often Germany is way stricter in privacy related issues the The Netherlands
<FromGitter> <yxhuvud> Also, EU has GDPR, and saving stuff like IP numbers is troublesome
<FromGitter> <yxhuvud> regardless of the direction the traffic is going.
<Papierkorb_> Hopefully this laughable "privacy shield" the EU thought up crumbles too.
<Papierkorb_> That thing that makes it legal to store private data in the US
<FromGitter> <sdogruyol> anyone using AMD's new ThreadRipper Cpus yet?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> That's Ryzen?
<Groogy> or is that the architecture after Ryzen?
<Papierkorb_> ThreadRipper was "Ryzen for servers"
<FromGitter> <sdogruyol> yeah
<Papierkorb_> Wasn't it literally two or more ryzens glued together or something?
claudiuinberlin has joined #crystal-lang
<FromGitter> <sdogruyol> I'd be happy to hear some real world Ryzen feedback too @Groogy
<Groogy> Also when it comes to monitoring employees, yes that is super illegal in the EU
<Groogy> Ryzen seems to work really freaking good
<Groogy> got 8k FPS out of it at home running Crystal :P
<Papierkorb_> On a single core no less
<Groogy> yeah
<Groogy> 8.5k was highest framerate I got
<Papierkorb_> I'm pretty happy that AMD finally pushed out a viable line of CPUs. Their GPUs are looking promising too, the current line made lots of ground
<Groogy> It was so low that the delta between frames I was monitoring for game loop update sometimes became 0
<Papierkorb_> Can't tackle nvidia for gaming just yet, but it's not bad for that either
<FromGitter> <sdogruyol> @Groogy 8k, lol
<Papierkorb_> And FU nvidia for disabling features in the driver by "accidentially" breaking it
<FromGitter> <sdogruyol> I've been using AMD for like more than 15 years (before switching to mac) :P
<Groogy> there you go serdar
<FromGitter> <sdogruyol> thanks 👍
<FromGitter> <sdogruyol> 1) 06ms lol
<Papierkorb_> Groogy: So is this gaming in 8K everyone's talking about?
<Groogy> osd_averate_time_spent_per_frame
<Groogy> haha lol isn't the new thing 4k ultra hd?
<Groogy> 8k hasn't come yet right?
<FromGitter> <barisbalic> Looking at the JSON mapping/builder stuff right now, I can't see a way to do something that I want, but... maybe I'm doing something daft. I want to use the JSON::Builder to create some JSON where a single field actually references an object that has it's own mappings via JSON.mapping macro. Is this currently possible?
<Groogy> so 0.06ms must be like... 60 microseconds right?
<Papierkorb_> 60µs sounds about right
<FromGitter> <bararchy> Groggy it makes me think of simcity 2000 :)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> OH I think it is actually lower than 60 microseconds it is just breaking at that point
<Groogy> because it is 120 for the application, wheras 60 of those comes from the application benchmarking (the second value)
<Groogy> I think
<Groogy> nah the math holds up with 1/8500=0.000117......
<Groogy> @bararchy here's a bit better view :D
<Groogy> though this is when it is built in debug
<FromGitter> <sdogruyol> has anyone else seen this? (yet)
txdv has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> your colleagues e.g
<FromGitter> <bararchy> I'm, playing citis:skyline now, and those grids make me happy hahaha
<Groogy> nope
<Groogy> the grids are just visual help for me debugging :P
<Groogy> but yeah I am sharing this here first
txdv has joined #crystal-lang
<Groogy> gonna present it to the company to get permission to put on a patreon or something when I get back to where I was in C++
<FromGitter> <bararchy> 👏
<FromGitter> <sdogruyol> @Groggy that'd be awesome 💯
<Groogy> If I don't get that permission I'll just still put it out there for free for people to contribute too
<Groogy> though I will probably not have Ego (the game project) in one of the open source licenses, probably get something drafted up by the legal team here
<Groogy> since I would want to own the trademark when I finally name the game
<Papierkorb_> Don't you own all code already?
<Groogy> Yeah but if I want to own the trademark but it is free for people to just take the game and remake it into their own it becomes really hard to defend that trademark
<Groogy> game source will be available open source and people can contribute to the code, but to keep things "simple" it would be best to ensure future problems don't occur
<Papierkorb_> Seems to be common to put the game assets into a restrictive license and OSS the engine code itself
<Papierkorb_> at least ID does it
<FromGitter> <bararchy> I would totally buy a game written in Crystal , even just for support
<FromGitter> <bararchy> but Groggy I expect AAA level graphics yeha ? else my $ back ;)
<Groogy> Well it is a legal gray area really. Let's say I have a patreon, you contribute code to that project and I accept the pull request. I don't think legally that I own that code without extensive mark of that you resign that right upon doing the pull request
<Groogy> Lol bararchy the game is going to be free no matter what
<Papierkorb_> Groogy: Also called a "CLA"
<Groogy> but you never know about the future how things go down so it is better be safe than sorry
<Groogy> what is called a CLA?
<FromGitter> <bararchy> what you descirbed
<Papierkorb_> ^
<Papierkorb_> Which commonly turns people away in any case.
claudiuinberlin has joined #crystal-lang
<Groogy> besides a patreon would be not to make money but to fund like webpages etc and things regarding the game itself. I earn more than enough as it is
<Papierkorb_> Groogy: The easiest way is to license engine code under a (F)OSS license of your liking. The player would then buy your game, but actually "only" pay for the assets
<Papierkorb_> No CLA mess in that case
<Papierkorb_> There are plenty licenses to choose from that have been proven in court :)
<Groogy> and potentially pay for expertise help like making art assets using the patreon money
<Groogy> stuff I can't do myself
<Groogy> I was thinking Boleite and the other projects aorund would be zlib but then have the game itself something else
<Papierkorb_> Yep. Scripts, models, all assets that make a game out of the game engine
<Groogy> though with how Crystal includes source I don't know how well that works
<Groogy> though zlib is extremly permissive so
<Papierkorb_> zlib is almost public domain
<Groogy> I guess zlib would just force one to put the contributors of the projects in credits, which I was planning to do anyway with bindgen etc.
<Groogy> we also have all the libraries we use that are open source in our credits
<Papierkorb_> On that: Bindgen is GPLv3, but code generated by it is *yours*
<FromGitter> <bararchy> How does that work ?
<Groogy> yeah so I can't include bindgen directly but Ican use the code generated
<FromGitter> <bararchy> LGPL ?
<Papierkorb_> I think the latter part is obvious, even to courts, but I wrote that into the README just in case
<Papierkorb_> Groogy: Correct.
<Groogy> as soon as money gets involved this shit gets so complicated xD
<Papierkorb_> bararchy, no pointer in LGPL for bindgen. LGPL is generally rather pointless for Crystal :(
<Papierkorb_> bararchy, which is why I use MPL-2 in the case I want something like LGPL
<Groogy> yeah LGPL is the "if you link dynamically it's k" right?
<Papierkorb_> In short, yes
<Papierkorb_> Some projects use LGPL with an addendum to allow static linking, but that's confusing and not battle tested.
<Papierkorb_> MPL-2 is similar to LGPL in the (to me) important aspects, but allows static linking
<Groogy> I did have talk with our legal person and she was first like "What no that doesn't work... wait hmm" when I asked if you could own a trademark but open source it
<Papierkorb_> Sure it works great
<Groogy> it could potentially work and I might try it when Iget that far
<Papierkorb_> Groogy: Linux, Qt, ..
<Papierkorb_> All trademarks for OSS, Qt even commercial and OSS
<Papierkorb_> And Linux even FOSS
<Groogy> all I want is people to contribute to the game so I don't have to do al lof the tons of details xD
<Papierkorb_> To the /game/ would be CLA hell
<Papierkorb_> to the engine would be no biggie
<Groogy> system is built so like if you want behaviour difference between a birch tree and a oak tree, you can put that in
<Groogy> and I don't feel like doing all that detail myself
<Groogy> but knowing our fanbase, there's tons of people who care and are willing to put that effort in
<Papierkorb_> Yes modders. But you need gamers first to turn them into devoted modders
<Papierkorb_> And you get gamers by having a game
<Groogy> of course
<Groogy> well I do have one, I just need to port it to Crystal (which I am doing because I was doing a major refactoring of big systems since I hit a limitation so might as well ^^)
<Groogy> also this time doing it in 3D instead of 2D
<Groogy> ah took me some time to find an image from the original:
<Papierkorb_> The #00FF00, it burns
<Groogy> it's beutiful :v
<Groogy> at least you don't see the "end of the world", that's neon pink obviously
txdv has quit [Ping timeout: 260 seconds]
<Groogy> what does Crystal use for contributions?
<Groogy> i.e the CLA stuff
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_> Crystal is under the MIT, and thus, doesn't require it
<Papierkorb_> a CLA is something the contributor have to actually actively sign (digitally is fine), and only then you may accept the code
<FromGitter> <Rinkana> Looks good Groogy
<Papierkorb_> So that alone is a huge hassle on your end chasing people
<Groogy> hmm actually seems Github has their own tool for it
<Papierkorb_> Not to mention that many people don't feel like signing some random contract for a small contribution
<Groogy> though Crystal is owned under Manas right?
claudiuinberlin has joined #crystal-lang
<Groogy> thx @Rinkana!
<FromGitter> <bararchy> "Owned" ? It's MIT, means you can clone, put your name there, and it's yours
<FromGitter> <bararchy> it's copyleft
<Groogy> ah
<Papierkorb_> Groogy: E.g., the prettified code just recently. If you wanted to use that, you'd have me sign the CLA. Which I would've refused
<FromGitter> <Rinkana> :')
<Papierkorb_> And now you have a dilemma: You can't use the code, obviously. You can replicate it, but watch out that it's not a copy "with small changes", as that could be counted as being a derivative of my work.
<Groogy> yeah I know :/
<Papierkorb_> A CLA is a really huge hammer I wouldn't use. A big company? Okay, I understand it. But for small companies, or even one-man armys, I'd advise against it
<Groogy> I guess this is why DF is not opensource ^^
<Papierkorb_> Groogy: A compromise for you could be that the scripts are open/free, but the other assets aren't
<Papierkorb_> DF?
<FromGitter> <bararchy> Papierkorb_ What about what the linux kernel uses ?
<Groogy> dwarf fortress
<Papierkorb_> bararchy, since when does Linux have a CLA?
<FromGitter> <bararchy> "DCO"
<FromGitter> <bararchy> not the same thing, but serves the same purpose
<Papierkorb_> That thing reads fine. Foremost, it's short and plain english
<Papierkorb_> It's just "oh yeah I totally have the right to contribute this"
<Papierkorb_> Looks to be a simple fools hook against stolen code
<Groogy> and you have to sign each commit I believe
<Papierkorb_> That thing doesn't waive my rights
<Papierkorb_> Which under a CLA I dp
<Papierkorb_> *I do
<Papierkorb_> I once thought about contributing to Qt. Then I saw the CLA. And gerrit.
<Papierkorb_> Suffice to say, I never got something into Qt
<Groogy> well problem becomes the second money is involved, DCO haven't waivered ownership of the contribution, only enforced responsibility if wrongdoing happens
<Papierkorb_> correct
<Groogy> as a hypothetical, the cleaned up code for text rendering. Let's say the game is free, but it wins an award at let's say Nordic Games Conference
<Groogy> what happens then?
<Papierkorb_> What should happen?
<Groogy> Well I would claim the award on behalf of the project but someone who has contributed could challenge that
<Papierkorb_> You get the award for the game
<Papierkorb_> the engine isn't a game
<Groogy> no but I want people to contribute to the game as well
<Groogy> and that's when things gets tricky
<Papierkorb_> Linus Torvalds doesn't get a say either just because you built your game on a linux box
<Groogy> like I said zlib is the license of the engine
<Papierkorb_> my primary concern would actually be people git cloning all assets and then playing for free. Or rather, someone repacking it for the noobs to play
<Groogy> well it is supposed to be for free
<Groogy> but even being free circumstances like this can come up where potential legal problems can occur
<FromGitter> <bararchy> Hm....
leafybasil has joined #crystal-lang
<Groogy> hmm I should look at some of the other OSS games that exist
<FromGitter> <bararchy>
<Papierkorb_> Nexuiz
<Papierkorb_> there was also some open mmorpg
leafybasil has quit [Remote host closed the connection]
<FromGitter> <bararchy> wow, 0AD os a license nightmare Oo
<Groogy> yeah was looking at unknown horizon they didnt' really have anything besides GPL
<FromGitter> <bararchy> damn
<Papierkorb_> > Various (unspecified)
<Papierkorb_> excellent
<Groogy> oh wow
<Groogy> they have licenses to specific folders
<Papierkorb_> which would actually be great .. if it was only one license per folder
<FromGitter> <yxhuvud> Hmm, I'm pretty happy with how the initial version of my parser DSL turns out,
<FromGitter> <bararchy> ```code paste, see link```
<FromGitter> <bararchy> :(
<Groogy> what's cappage?
<Groogy> cabbage*
<Papierkorb_> something to wat
<Papierkorb_> eat*
<FromGitter> <yxhuvud> still lacking some necessary stuff to be actually usable, like support for character ranges and left recursion optimization. Also needs a total rework of how terminals are handled. But it is a good start :D
<FromGitter> <yxhuvud> groogy: it is a parser based on the earley algorithm.
txdv has joined #crystal-lang
<FromGitter> <Rinkana> Groogy, how would you go about applying a material to a set vertices? Let say i have a set vertices with an color inside an mesh object. And i want to apply an material wich would set them to another color.
<FromGitter> <Rinkana> Would you recalculate the vertices or switch to the material when rendering if a material object is found. Or even build vertices later on in the process
<Groogy> is the color uniform over all vertices in the mesh?
<Groogy> or does each vertice need to have its own color?
<FromGitter> <Rinkana> Each need their own color. And materials should be able to support textures later on.
<Groogy> you could put the color in its own buffer you upload
<Groogy> so you don't have to upload the position part of the vertex each time you modify it
<Groogy> but what kind of material would apply a secondary different color on each vertice?
<FromGitter> <Rinkana> They are two different buffers right now. It's mainly the process of converting vertexes + material to vertices
<Groogy> could you give me a link to the source or something so I get a bit more context?
<FromGitter> <zyriuse75> how can i know if the user run the script as root ?
<oprypin> zyriuse75, i told you dont do it, and also in that link you have examples of C function getuid i think
<oprypin> so you bind the libc getuid and check if its result equals 0
<Papierkorb_> * `geteuid()`
<Papierkorb_> I also looked in Process for it
snsei has joined #crystal-lang
<Papierkorb_> Though we should think about having a `#has_administrive_permissions?` or similar, which does the check on each platform
<Papierkorb_> I mean: Does windows stuff on windows, or geteuid everywhere else lol.
<Papierkorb_> Though I'd actually enjoy having "proper" user and groups access classes.
<FromGitter> <bararchy> Ruby has that via "Etc"
<Papierkorb_> I mean classes, not random functions
<FromGitter> <Rinkana> Groogy, here is the basic code that for now switches between the vertex color and between the material if it is set:
<FromGitter> <Rinkana> However it should be that the vertex already has the correct color from the material.
<Groogy> color_buffer.set([material.color] * mesh.vertices.size) this irks me, because this could just be a uniform
<Groogy> so what you want is a material structure that can override the color component written into the vertices?
<Groogy> all materials apply unilaterally the same on all vertices that have that material right?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> I would have the material values upload as uniforms, and you have a default material for default values for the uniforms
<Groogy> that way you can then in the shader decide to use material color, vertex color or some math to combine them
<FromGitter> <bew> @yxhuvud really nice! I learned about Earley parsing some time ago, I'm happy someone's doing sth in crystal! (I'm also having fun making a parsing lib in crystal, but more for PEG)
<Groogy> like outputColor = materialColor * vertexColor
<Groogy> and default value for materialColor uniform is just 1.0
<Groogy> or however you want it to treat the material
<FromGitter> <bararchy> building Crystal head, I still get this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Didn't we fixed that already ? []
<FromGitter> <Rinkana> Ah i see
<FromGitter> <Rinkana> I'm going to work on that, thanks
<FromGitter> <Rinkana> And sorry for the n00b opengl questions :P
<Groogy> no its fine :P
<Groogy> ow yeah how do you put together your shaders?
<FromGitter> <Rinkana> Like building them or..? They are located here:
<Groogy> I recommend you put together something that can parse them like this:
<FromGitter> <Rinkana> As you can see they are very basic
<Groogy> managing the states etc manually per drawcall is going to be really annoying
<Groogy> theres some states/values not shown like blending etc.
<Groogy> gonna add face culling to it later
snsei has quit [Remote host closed the connection]
claudiuinberlin has joined #crystal-lang
DTZUZO has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
<Groogy> so like for instance my sprite and text shaders turn of depth testing in the shader since they don't care about depth
<Groogy> and I find that easier to do than having the Sprite or Text manage to turn off depth testing and then turn it on again
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Rinkana> And you use different shaders for all different kind of objects?
<Groogy> yeah
<Groogy> this shader though gets inlined into the source code
<Groogy> also here's an example of Text with some blending:
<Groogy> should probably add htat to sprite as well
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <bararchy> Oh Groogy I remmbered that I added the Makefile to "ego" , so now I too own the game ? ;) MUHAHAH
<Papierkorb_> everyone owns a slice of the ego pie :P
Papierkorb_ has quit [Quit: Konversation terminated!]
<Groogy> aw man
<Groogy> well I can still remive it
<Groogy> remove it*
xiljin has joined #crystal-lang
<FromGitter> <bew> Groogy this would strengthen your ego x)
<Groogy> well the project name is just named after that it is an ego trip the project ^^
<Groogy> name from start was Project Nietzsche
<Groogy> but I had to google the name everytime to make sure I spelled it right xD
<FromGitter> <bew> ahahah
<FromGitter> <Rinkana> Like you did just now? :P
<Groogy> yepp
<Groogy> ಠ_ರೃ
flaviodesousa has quit [Ping timeout: 240 seconds]
tzekid_ has left #crystal-lang [#crystal-lang]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
alex`` has quit [Ping timeout: 255 seconds]
alex`` has joined #crystal-lang
ducklobster has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <bararchy> Groogy all is good , I waive my rights to the Makefile , and you can take full owener ship of those 2 lines and 4 spaces ;)
<Groogy> lol
<FromGitter> <bararchy> (2 years later - ego get a triple A status and makes millions, I cry in a dark corner )
<Papierkorb> All because of your hard Makefile work
claudiuinberlin has joined #crystal-lang
<Groogy> lol I am not gonna charge for the game xD
<Groogy> but there's tons of other problems that can occur that is within the same kind of domain
<crystal-gh> [crystal] straight-shoota opened pull request #5092: Add docs to expectations methods (
mark_66 has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <jwoertink> Hey @oprypin, great job on this crsfml. I've been playing around with it a bit.
DTZUZO has joined #crystal-lang
<oprypin> :)
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<crystal-gh> [crystal] oprypin opened pull request #5093: Add documentation and type annotations for Time (master...time-doc)
<ducklobster> if i am trying to package up a static file (lets say a .css) file into a binary command line app
<ducklobster> is the best way to do it with a HEREDOC style string
<ducklobster> or is there a way of packaging assets into the binary app
<ducklobster> awesome, thanks
<oprypin> ducklobster, for simple text file you can probably just do CSS = {{`cat style.css`}}
<ducklobster> what is the {{` `}} syntax exactly? is that a preprocessor / compiletime step?
<ducklobster> ah, very cool, thanks for the info
<oprypin> `` is separate
<oprypin> ducklobster, also has to be like this CSS = {{`cat style.css`.stringify}}
<oprypin> but this works only for text files. that project i linked works for any file
<watzon> It's amazing how you can not use a language for a month and suddenly you forget a lot of the basics
<watzon> What's the best way to build a URL with queries? I'd like to not just do string concatenation.
<oprypin> watzon,
<watzon> oprypin: thanks!
<FromGitter> <georgeu2000> I have a method that takes either a single `Struct 1` or an array of `Struct2`: ⏎ ⏎ `def initialize(@items :Struct1 | Array(Struct2))` ⏎ ⏎ That seems OK, but how can I coerce @items into an array? []
<FromGitter> <georgeu2000> In Ruby, it would be `@items.to_a.flatten`.
<FromGitter> <bew> Hey watzon it's been a while indeed! we missed you? ;)
<RX14> the mailinglist sure does seem to love elixir pipes
<FromGitter> <bew> @georgeu2000 what do you mean? "When it's an array do that do that"?
<FromGitter> <georgeu2000> I'm not sure what you mean, but I want to call ` ...`
<RX14> it drives me up the wall how some people seem to keep bringing up the elixir pipes issue even though it's been argued against so much
<FromGitter> <georgeu2000> I guess I can check the type of `@items`, but it does not seem very idiomatic...
<FromGitter> <georgeu2000> Maybe because it is not idiomatic for a typed language...
<FromGitter> <bew> wut
<FromGitter> <bew> `Struct1` probably don't have `#map` method, so you'll have to check for the type
<oprypin> georgeu2000, that should be 2 different items
<oprypin> georgeu2000, that should be 2 different methods
<Papierkorb> RX14: not even that, but not a single person has yet brought up a valid use-case that isn't already possible with a similar amount of characters to type
<RX14> less
<RX14> . is way less than " |> "
<FromGitter> <OldhamMade> the `{{ cat styles.css }}` trick is useful. are there any websites/etc with such tricks I could subscribe to? (@oprypin)
<RX14> plus there's no implicit caller so you need to specify the Full::Namespaced.function as well
<RX14> it's just a bad suggestion in almost every way
<FromGitter> <georgeu2000> @oprypin - I thought that, but everything else in the method is the same...
<FromGitter> <OldhamMade> heh, well, maybe I could've added the word "curated" ;)
<oprypin> georgeu2000, call the other method. def a(x : One); a([x]); end
<Papierkorb> RX14: even if it'd pass the first argument and the receiver .. meh
<FromGitter> <georgeu2000> @oprypin - OK, thanks. I'll give that a try.
<RX14> the first argument is the reciever in pipes Papierkorb
<Papierkorb> Yes in pipes
<Papierkorb> in elixir pipes
ShalokShalom has joined #crystal-lang
<RX14> yes, i dont see what you mean by "first argument and reciever"
<Papierkorb> ` |> foo.baz` = `foo.baz(`
<RX14> i dont see why you'd do that though
<Papierkorb> I don't need it either lol
<RX14> no but isn't that the normal pipes suggestion Papierkorb?
<RX14> that they were suggesting regardless?
<oprypin> RX14, it is, it just seemed like you misunderstood maybe
<RX14> no
<RX14> i mean that you'd have to do Array.sort instead of just .sort
<RX14> because there's no implicit reciever of objects
<Papierkorb> RX14: always looked like they wanted `` instead of `` for some arcane reason
<RX14> yes
<RX14> exactly
<RX14> so the syntax is longer and it makes the function calls longer as well
<Papierkorb> .. yes ok, foo has a receiver, but nothing useful. My sample would at least give you a reasonable receiver. Still, I don't want it.
<RX14> i don't mind pipes, but they work for functional languages
<RX14> and we're not a functional language so its just horribly out of place
<RX14> and obviated by objects
<Papierkorb> At least without an OOP-spin to it. But no one yet proposed a OOP-native derivation of that syntax. Just want an inferior syntax.
<RX14> it's just appears to be familiarity and unwillingness to think differently of how to solve a problem to me
<RX14> thinking in elixir while working in crystal
<Papierkorb> possibly. seems to be a vocal minority in any case
<Papierkorb> lawl I found a bug in jq
<Papierkorb> And I already thought that there's was a bug in my code. Nah, that'd never happen
<watzon> Lol look at Papierkorb, his head is gigantic
<FromGitter> <faustinoaq> Currently crystal on UNIX needs a CC compiler as dependency to link object files, so we should install gcc or clang as requirement but I just check windows linker support on What would be the dependencies for Crystal on Windows ? I think C++ Tools for Windows is a bit heavy as dependency 😅
<Papierkorb> I always relied on mingw on windows. If their x64 port is stable nowadays, I don't see anything wrong with it. But in any case, you can't win on windows.
<RX14> @faustinoaq we're going to need C++ tools
<RX14> that's a minimal dependency to me
<RX14> compared to mingw or some other non-native solution
<Papierkorb> mingw can be redistributed though, makes it easier to bundle it into a nice setup package
<Papierkorb> At least it's how the windows Qt installer operates. it gives you the option to, you don't have to use it at all
<RX14> Papierkorb, i assume that it produces binaries which dont depend on mingw though
<Papierkorb> it?
<RX14> qt
<Papierkorb> Well it depends on the runtime environment of each compiler. for msvc that's MS', for mingw, that's mingws DLL
<RX14> oh so the mingw compiler doesn't compile for win32?
<Papierkorb> Another point is that MSVC and mingws ABIs are incompatible
<Papierkorb> It does
<RX14> it just compiles for mingw?
<RX14> i was assuming it just used the mingw compiler to compile for w32 natively
<oprypin> that's like saying MSVC doesn't compile for win32
<Papierkorb> Define natively
<RX14> without including any mingw headers
<Papierkorb> it requiring a DLL doesn't mean it's not native. it's perfectly native
<RX14> well
<Papierkorb> it simply doesn't use windows' c lib
<RX14> actually without requiring any mingw runtime libraries
<RX14> it should produce an executable which runs without mingw
<RX14> it seems im confused on what mingw does
<RX14> im sorry
<RX14> it's just an alternate toolchain for native win32 isn't it
<Papierkorb> it's a port of the GNU C Compiler suite, including environment
<Papierkorb> And directly inheriting its ABI
<RX14> the mingw website implies it's using windows's DLLs and headers
<oprypin> it implements POSIX APIs using Win32 functions
<RX14> "MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows"
<RX14> ???
<oprypin> RX14, probably means it doesnt run ELF or something
<RX14> oh
<Papierkorb> It doesn't implement posix. maybe it provides some functions that MSVC wouldn't, but that doesn't make it posix
<RX14> i don't want us using gnu libc symbols
<RX14> thats not native to me
<Papierkorb> MSVC constantly breaks the ABI
<oprypin> RX14, why are you talking about that
<oprypin> pretty sure all efforts to port Crystal to Windows have focused on MSVC
<RX14> because if you're using libc symbols it means there's a translation layer
<RX14> and that layer is frequently buggy, or breaks unix assumptions
<oprypin> well yeah thats the downside
<RX14> for example fork
<RX14> is the most obvious
<oprypin> RX14, why are you talking about that tho
<Papierkorb> don't remember if mingw provides fork
<RX14> but there's obviously more
<RX14> oprypin, how is it not relevant?
<oprypin> RX14, well because nobody is trying to use mingw for crystal nor is planning to
<RX14> except @faustinoaq brought up the issue of needing the non-redistributable msvc toolkit
<Papierkorb> in the correct version
<RX14> and i was wondering if mingw was essentially a drop-in replacement
<RX14> except open source
<oprypin> maybe it is, who knows
<RX14> if it is
<oprypin> RX14, gcc's linker is being relied on, not any runtime
<RX14> yes
<oprypin> i dont think the choice of linker would affect the choice of runtime
<RX14> well using for example the cygwin linker would affect the choice of runtime
<RX14> or at least make it hard
wontruefree has joined #crystal-lang
<oprypin> might not be redistributable but installer could suggest downloading and installing it
<Papierkorb> how does rust do it?
wontruefree has quit [Ping timeout: 260 seconds]
claudiuinberlin has joined #crystal-lang
<FromGitter> <imonmyown> They're switching to rustup (a tool that does the installation, the last information that I have is that they ask which toolchain is to be used: MSVC or MINGW)
<FromGitter> <imonmyown> That's what @oprypin wrote and that's what is done in rust. You select the platform's target triple and the installer does the rest
<RX14> why would the target triple be different for msvc and mingw? surely they must be the same ABI to link?
<FromGitter> <imonmyown> I was wrong it's not mingw, its gnu
<RX14> yup
<RX14> thats a different ABI, not a compiler
<FromGitter> <imonmyown> right, sorry
<FromGitter> <imonmyown> corrected myself above, perhaps it was not relayed to IRC
<RX14> no, it's not
<RX14> we'd prefer if nobody used the fancy gitter stuff but what can you do :)
<FromGitter> <imonmyown> ok, got it
<FromGitter> <imonmyown> I don't care much about fanciness, I just found it easier to make it work for me :)
<FromGitter> <bararchy> RX14, great points in the discusstion thread
<Papierkorb> RX14: No. As I already said, MinGWs ABI is different to MSVCs ABI. Which is not that bad at all: MSVC versions aren't even compatible among themselves!
<Papierkorb> There's no stable MS ABI
<RX14> why
<RX14> how do their shared links work then
<Papierkorb> Who knows
<RX14> i dont even
<Papierkorb> By using the same compiler for the whole project
<RX14> shared libs*
<RX14> no like the windows ones
<RX14> that are distributed with the system
<Papierkorb> Have you never wondered why websites provide DLLs for MSVC2013 and 2015 (or w/e) separately?
<RX14> so why doesnt everything break all the time
<Papierkorb> Ever wondered what those MSVC redistribution packets are about?
<RX14> isnt there like
<Papierkorb> C
<Papierkorb> C is stable, C++ is not
<RX14> one win32.dll
<oprypin> lol
<RX14> yeah but crystal only uses the C abi
<RX14> lol
<RX14> thats what I was talking about
<Papierkorb> If mingw uses the same LL convention in C, they're compatible
<RX14> i don't care that the C++ abi changes all the time when it doesn't matter to crystal at all
<RX14> so they're the same abi
<RX14> right
<Papierkorb> That should be the only difference, as that's where Windows differs from *everyone else*
<Papierkorb> If MinGW emulates GNU, incompatible. If not, compatible
<RX14> i always thought C++ abi was different to the target triple
<RX14> im confused
<Papierkorb> Ah there we go, MinGW is compatible according to that table
<RX14> yes
<RX14> so surely it's the same C abi
<RX14> and we dont *really* have to care about C++ abi
<Papierkorb> Among the windows compilers
<RX14> bindgen does
<RX14> but not the raw crystal port
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client:]
chamar has quit [Read error: Connection reset by peer]
DTZUZO has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 255 seconds]
<FromGitter> <monouser7dig> > still lacking some necessary stuff to be actually usable, like support for character ranges and left recursion optimization. Also needs a total rework of how terminals are handled. But it is a good start :D ⏎ ⏎ @yxhuvud ⏎ tried left recursion optimization on ruby some weeks ago but left after I did ... and did some parsing tree (re)construction in
<FromGitter> ... java so maybe I'll take a look at your approach []
<FromGitter> <monouser7dig> btw is there a preference in crystal for alias vs type? I'd just use type but mainly see alias around here
<FromGitter> <bew> you should use alias all of the time
<FromGitter> <bew> `type` is only useful in some cases in lib bindings (e.g: changing a `Void*` to a more restrictive type in crystal land)
<FromGitter> <simaoneves> guys, just noticed we are over 10.000 commits, congrats!
<RX14> @monouser7dig we're thinking of removing type since it's super buggy
<RX14> alias is a transparent alias
<RX14> type makes the types non-interchangable
<RX14> but it really doesn't play out too well with the rest of the language and it turns out you can't simply shoehorn in the same type being incompatible with itself in an OO language like this
<Papierkorb> monouser7dig, or maybe easier described: alias is an alias (another name for the same thing). type creates a whole new type.
<RX14> and the type it creates is buggy
ducklobster has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] RX14 closed pull request #5091: Fix be_nil expectation to use .nil? (
wontruefree has joined #crystal-lang
<wontruefree> Are there any forking web servers in crystal?
<FromGitter> <faustinoaq> Papierkorb, oprypin, RX14 & @monouser7dig Interesting discussion about Windows port for Crystal ⏎ ⏎ > MSVC builds of rustup additionally require an installation of Visual Studio 2015 or the Visual C++ Build Tools 2015. For Visual Studio, make sure to check the "C++ tools" option. No additional software installation is necessary for basic use of the GNU build. ⏎ ⏎ Rust also requires C++ tools, so I
<FromGitter> ... think will be ok as Crystal requirement too. ... []
<RX14> wontruefree, why?
<RX14> why would you want a forking webserver?
<wontruefree> forking or threading
<wontruefree> a web server that can accepted concurrent requests
<FromGitter> <georgeu2000> Is there a good way to convert a Hash to query params? ( `.to_query` in Ruby)
<RX14> wontruefree, crystal's webserver can accept concurrent requests, just not parallel requests
<RX14> are you trying to get more performance out of more cores by parallelism, or have you got a long blocking operation which is hurting latency?
<FromGitter> <sdogruyol> Wow Rust is trying out ThinLTO
<FromGitter> <sdogruyol> Saying 2x faster compile times in release mode
<RX14> basically from reading it
<RX14> they had problems enabling parallel complication (maybe only in -r-elease mode)
<RX14> we had a thinlto PR and i think the same result was observed: it only helps release mode compile times (since we can now parallelize it)
<wontruefree> RX14 I am not noticing any problems now I just noticed it was not available and it was only using one core
<wontruefree> I had not realized it could handle requests in parallel
<wontruefree> I ment concurrent
<RX14> if you need more performance you can use reuse_port: true and spawn multiple processes
<RX14> that only works to scale "out" though
<RX14> because each server process needs to be stateless
<travis-ci> crystal-lang/crystal#885eda6 (master - Fix expectation be_nil to use `.nil?` (#5091)): The build passed.
<wontruefree> That should work
<wontruefree> thanks
wontruefree has quit [Ping timeout: 260 seconds]
<FromGitter> <georgeu2000> Is there support for something like `%q` for strings?
<FromGitter> <georgeu2000> Use case: the string is `"foo"` with quotes.
<FromGitter> <ezrast> `%q` works
<FromGitter> <georgeu2000> Oh, I see: `%q{foo}`. Thanks.
<FromGitter> <georgeu2000> No arbitrary delimiters.
<FromGitter> <georgeu2000> Seems like Crystal is "do things one way".
<FromGitter> <ezrast> Moreso than Ruby but that's not saying a whole lot