jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Oliphaunte has joined #crystal-lang
zacts has quit [Ping timeout: 258 seconds]
Philpax has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
zacts has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
<zacts> Is the crystal language itself stablized?
<zacts> will code I write for crystal today, run tomorrow?
Oliphaunte has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
Oliphaunte has quit [Ping timeout: 276 seconds]
<FromGitter> <zacts> hi
<FromGitter> <zacts> I guess I'll hang out here probably more than on freenode
matp has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<asterite> zacts: I don't think there will be many more breaking changes in next releases, but there's a chance, at least until 1.0
<zacts> asterite: cool
<zacts> should I chat here or on gitter?
<zacts> which is preferred?
<asterite> there's a bridge between the two, so either is fine :)
<zacts> cool cool
Oliphaunte has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
Yuolime has joined #crystal-lang
Yuolime has quit [Client Quit]
zacts has quit [Quit: WeeChat 1.4]
pawnbox_ has quit [Ping timeout: 250 seconds]
Oliphaunte has quit [Quit: Eye deed]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
ome has joined #crystal-lang
<FromGitter> <sdogruyol> Morning everyone
zodiak_ has joined #crystal-lang
zodiak has quit [Ping timeout: 240 seconds]
Philpax has quit [Ping timeout: 240 seconds]
mark_66 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
ome has quit [Quit: Connection closed for inactivity]
trapped has joined #crystal-lang
A124 has quit [Ping timeout: 260 seconds]
matp has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
dminuoso has joined #crystal-lang
<dminuoso> jhass: Let's continue this here. :)
<dminuoso> #rubyonrails feels like the wrong place to discuss that topic.
<jhass> ok :)
<jhass> :P
<dminuoso> Okay, that makes the compiler fairly straight forward then, but also does not allow for aggressive optimizations.
<jhass> so yeah, it's parse/lex, do semantic analysis on the AST (infer types, transform syntax sugar), generate LLVM IR
<jhass> let do LLVM the optimizations
<jhass> it's pretty good at it
<jhass> the problem with (J)VM based stuff is that it's only really suitable for commercial server apps
<jhass> the warmup phase and base memory requirements are just too much for a lot of stuff
<jhass> people only argue on how well stuff utilizes the CPU, which is fine for when buying servers is not much of a problem for you
<jhass> but it's nothing for CLI apps or stuff everyday joe should run on their $5 VPS
<dminuoso> jhass: Indeed. Have you watched that graal/truffle talk that chrisseaton mentioned 2 days ago?
<jhass> nope, read the article yesterday though
<dminuoso> The warmup phase for that relatively trivial was incredible. On the first pass the application took about 3 times as long as CRuby because of initializations and warmup, though after that it quickly figured out how to optimize and ended up speeding execution up to about 40 times.
<dminuoso> *relatively trivial code example.
<jhass> it's just interesting how they completely neglect memory usage in their examples, it's rare to see a graph for it by the JRuby folks
<dminuoso> Honestly, people need to stop worrying about memory.
<dminuoso> It's not a resource that is limited by what you have, it's a resource limited by what you can buy. :-P
<jhass> startups and stuff yes
<jhass> and now you wonder why Ruby never got big on GUI apps?
<dminuoso> Heh.
<jhass> it's very relevant for desktop apps
<jhass> it's very relevant for the self-hosting movement
<dminuoso> jhass: A lot of it is probably related to the fact that CRuby's GVM is deadly to any GUI framework.
<dminuoso> *GVL
<dminuoso> But I get your point.
<dminuoso> Perhaps having worked for companies where you had rooms filled with hundreds of SGI octanes - because if computation is too slow, the easiest solution is to simply scale up, I just gained a different perspective.
<jhass> yes and you're not alone, I think there's a lost focus in the community about it
<jhass> I rewrote my main IRC bot from cinch to Crystal
<jhass> performance went up a bit, but heh it's just IRC, not that relevant
<jhass> memory went from > 200M to ~10-15M
<jhass> so I could run 20 of these in place of one Cinch based one
<jhass> I hate how Ruby never free(2)'s
<jhass> the JVM ain't much better
<jhass> have two ruby processes spiking over 50% of your available RAM but never at the same time? no sorry, you can't have that
<Papierkorb> dminuoso: C++/Qt can show a complete GUI app and do things in the background (like downloading a file) just fine in a single thread. The concept of not having the environment provide some sort of reasonable asynchronous mechanism for things like this is just plain bad habit.
<jhass> Crystal too btw
<Papierkorb> jhass: have you tried C++/Qt at some point?
<jhass> nope
<jhass> my DE is Gnome so I'm more inclined to build Gtk stuff
<dminuoso> Papierkorb: Oh absolutely.
<Papierkorb> They basically have that mechanism of 'signals and slots', which is easiest compared to a pub/sub mechanism. A button e.g. has the clicked() signal, and you can connect one (or more) slots (which are just C++ functions or lambdas) to those. Really powerful as it's used for *everything*
<Papierkorb> In fact, I didn't even notice we're in #crystal-lang and not #ruby Oo
<dminuoso> Papierkorb: We modelled an entire VR application around Qt
<dminuoso> Quite successfully.
<dminuoso> It even integrated with various computing centres and physics emulation centers nicely.
<Papierkorb> I love C++/Qt, it's also really painfree and enjoyable to write network daemons with that concept
<jhass> I think Gtk's signals and events are fundamentally the same thing
<dminuoso> jhass: They are indeed.
<Papierkorb> Yes I think so
<dminuoso> jhass: I mean such style is implicitly implemented by posix compatible operating systems with blocking IO for example.
<Papierkorb> jhass: What's crystals primitive for such things?
<Papierkorb> dminuoso: Yes, QSocketNotifier <3
<Papierkorb> Haven't really looked at Crystal since version 0.8
<jhass> heck, probably even Xorg/Wayland work in a comparable way
<jhass> Papierkorb: not sure what you mean
<Papierkorb> jhass: signal/event, "pub/sub" primitive
<jhass> well, I guess Channel
<jhass> Go like
<jhass> there's no real pub/sub lib in stdlib (yet)
<Papierkorb> Is there something comparable to Rack already?
<jhass> not as defined, no, but everybody uses HTTP::Server already and I think we do intend to make it good enough for the vast majority of people
<Papierkorb> on the long run, I'd love to have a "port" of the 'roda' gem. After that, sinatra-esques don't cut it for me anymore :(
<jhass> do one ;)
<jhass> perhaps there even is one already, I lost overview of all the webframworks we got already
<Papierkorb> are shards now de-facto standard for projects?
<FromGitter> <sdogruyol> Papierkorb why not Sinatra like?
<Papierkorb> sdogruyol: Have you tried Roda? It uses a routing tree, which automatically makes it dead simple to keep your web app DRY and IMO easy to follow, as the routing itself and your logic is just normal Ruby/Crystal code
<FromGitter> <sdogruyol> I like Roda
<FromGitter> <sdogruyol> Haven't used in anything though
<jhass> Papierkorb: yes
<jhass> crystal init app / crystal init lib will generate a shard
<Papierkorb> What I really don't like is that sinatra essentially says that the routing is "flat", which is to me an unnatural modeling of the real world
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<Papierkorb> > On a 64-bits machine it lets us spawn millions and millions of fibers. In a 32-bits machine we can only spawn 512 fibers, which is not a lot. <- Huh, why's that?
<Papierkorb> I agree with 32bit getting obsolete, but sounds interesting regardless
<txdv> i run 32bit on my old web machine
<txdv> no docker 32bit version
<txdv> no memsql for 32bit
<txdv> im missing one more
<txdv> i have to upgrade to 64bit
Philpax has joined #crystal-lang
<Papierkorb> if it's a linux distro, there's likely a guide for it to upgrade it by, in the end, "simply" installing every package again, but in its 64bit version. You don't loose anything really
<FromGitter> <sdogruyol> Papierkorb a Fiber allocates 4k so 2**32 / 4096 = 512
<Papierkorb> sdogruyol, (2**32) / 4096 = 1_048_576
<Papierkorb> 32bit machines managed more than 512 pages :)
<txdv> Papierkorb: really?
<txdv> that would be ... awesome
<Papierkorb> txdv: not saying the docs are wrong, just the calculations is
<FromGitter> <sdogruyol> oh
<txdv> Papierkorb: TL;DR: It is doable, but complicated. I have outlined an alternative at the bottom.
<FromGitter> <sdogruyol> that's definitely has to do with memory allocation limit. my math might be wrong :P
<txdv> ill just do a clean install
<txdv> although ill have to save some stuff
<Papierkorb> sdogruyol, but divided by 8MiB it's 512, so it may be a worst-case calculation
<txdv> 84 days uptime
<Papierkorb> I guess the runtime mmap()s the max stack space into the process space, for which it needs to use the 8MiB. Even if it's not completely used, after 512, you run out of addressable space
<jhass> it's running out of address space or something
<jhass> yeah, I guess
buggs has joined #crystal-lang
buggs has quit [Client Quit]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #3025: Unify String and Char to integer/float conversion API (master...to_num) https://git.io/vKPj9
<asterite> Of course one could buy more servers, but I think in the long term: less memory + faster execution speed -> less machines for the same task -> less energy consumption -> a greener world
<asterite> One of Crystal's secret goals is a greener world
<jhass> <3
<dminuoso> asterite: See, and I just went to our network operation center and had them order a separate machine with big expensive CPUs and 10g interfaces while you were pondering about this!
<dminuoso> Just because we have money to burn!
Raimondii has joined #crystal-lang
Oliphaunte has joined #crystal-lang
<j2k> How do you figure out the parameter for "@[Link("xxx")]" ? (Writing bindings for C library)
trapped has quit [Read error: Connection reset by peer]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKXTT
<crystal-gh> crystal/master fecbc1c Ary Borenszweig: Compiler: rename `@mod` to `@program` (refactor)
Raimondi has quit [Ping timeout: 240 seconds]
<jhass> j2k: it's just appended to the linker as an -l flag, @[Link("foo")] -> -lfoo
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKXTm
<crystal-gh> crystal/master 765072c Ary Borenszweig: Merge pull request #3023 from crystal-lang/feature/lazy_getter...
<j2k> jhass Yea I have never done any coding this native before. The linker is saying "-lremotelib not found"
<j2k> I'm loading the path correctly I think (Following libui bindings example).
<j2k> All my other stuff in C,python etc just load the file directly
<j2k> (dlopen)
<jhass> j2k: -lfoo expects libfoo.so (or libfoo.dylib on OS X) in your $LIBRARY_PATH or default linker locations (/lib, /usr/lib/, /usr/local/lib)
Raimondii is now known as Raimondi
<j2k> ah thanks jhass - I had -llibfoo
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
A124 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#fecbc1c (master - Compiler: rename `@mod` to `@program` (refactor)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/146383015
dminuoso has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#765072c (master - Merge pull request #3023 from crystal-lang/feature/lazy_getter): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/146383313
dminuoso has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
mark_66 has quit [Quit: Leaving.]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
dminuoso has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Excureo has joined #crystal-lang
<asterite> Papierkorb: I believe roda for Crystal is toro: https://github.com/soveran/toro
<Papierkorb> asterite: ah, interesting. It is comparable, yeah
Philpax has quit [Ping timeout: 252 seconds]
<Papierkorb> Looks like a mix between Sinatra and Roda for routing
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Client Quit]
Oliphaunte has joined #crystal-lang
willl has joined #crystal-lang
Kurisu has joined #crystal-lang
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
<BlaXpirit> hello. I just found out that crystal has no guarantees regarding memory layout of class members which makes me very sad. I assumed they would at least be sequential
<BlaXpirit> https://carc.in/#/r/14i6 - anything I can do about this?
<BlaXpirit> this kinda kills my very big project
<FromGitter> <sdogruyol> you thought that this'd be the same every time?
<FromGitter> <sdogruyol> i mean the memory layout
<BlaXpirit> sdogruyol, well it is the same every time but i want it to be in the same sequence as I define it
<BlaXpirit> but @b_stuff puts itself before @b
<Yxhuvud> I guess 'use a struct' is not a good enough workaround?
pawnbox has quit [Remote host closed the connection]
<leafybasil> I find the HTTP::Params API a little strange, I would expect "build" to return an object that will still allow me to add more params to
<leafybasil> Or at least I would expect there to be some way of creating an instance and adding params before producing a string
Nik736 has joined #crystal-lang
Nik736 has quit [Client Quit]
<BlaXpirit> Yxhuvud, no it isn't
<BlaXpirit> Yxhuvud, and in fact structs have the exact same problem
<BlaXpirit> leafybasil, well don't use build, use new
<leafybasil> BlaXpirit: I think I may have just found that mty version was behind docs
<BlaXpirit> huh
<leafybasil> BlaXpirit: basically anything I just said may have been invalid anyway
maxpowa has quit [Ping timeout: 252 seconds]
Oliphaunte has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
maxpowa has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<BlaXpirit> so does anyone have an idea how to force a class to have its fields be in a particular order?
<BlaXpirit> what i'm doing is allocating a contiguous area of memory by using a StaticArray, and then letting C code save its state there
<BlaXpirit> but uh then I subclass that and add another StaticArray, for the extra data that the subclass in C code may need
<BlaXpirit> and at the very end I want my custom data
<BlaXpirit> but unfortunately it turns up in between the two StaticArrays and gets overwritten by C code
Raimondii is now known as Raimondi
Philpax has joined #crystal-lang
<FromGitter> <mverzilli> hey Blaxpirit, I doubt anyone but Ary is in a position to help you or at least give you a definitive answer on this. Your use case sounds quite interesting, but he may miss this unless he connects soon. Why don't you create an issue on GitHub?
<BlaXpirit> oh i don't want to make an issue because it's a crazy usecase that is not meant to happen but I wanted to eliminate layers upon layers of wrappers
<FromGitter> <mverzilli> I don't know if it's *that* crazy, in a way it reminds me of the kind of approach that Google took with TensorFlow (although I'm not sure if it's exactly the same thing)
<FromGitter> <mverzilli> even if the use case is a very border one, you never know... maybe it's trivial to fix
<BlaXpirit> i'm afraid the fix would prevent LLVM from doing optimizations
<BlaXpirit> for now I'll just ping asterite, maybe he'll check this out
<FromGitter> <mverzilli> (Y)
maxpowa has quit [Ping timeout: 264 seconds]
Oliphaunte has quit [Remote host closed the connection]
maxpowa has joined #crystal-lang
Oliphaunte has joined #crystal-lang
pawnbox has joined #crystal-lang
ssvb has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
Oliphaunte has quit [Remote host closed the connection]