ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.21.1 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter> <schoening> if foo = bar ... end is only gonna assign bar to foo if bar is truthy, right?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
<FromGitter> <phoffer> that would assign it, but not enter the block if it was false
txdv has quit [Ping timeout: 246 seconds]
xmonader2 has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
<FromGitter> <codenoid> hi sir, i have some questionl, how to allow CORS in crystal server (i'm in kemal framework)
<FromGitter> <eliasjpr> Hey I believe you will have to write a http::handler that implements CORS since Kemal does not include cors to my knowledge
<FromGitter> <khepin> is there a way I can make a symbol from a string?
bjz has joined #crystal-lang
<FromGitter> <phoffer> @khepin no, Crystal doesn’t have dynamic symbol creation like ruby
<FromGitter> <khepin> thanks
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<FromGitter> <codenoid> @eliasjpr how ?
<FromGitter> <codenoid> i'll try this
A124 has joined #crystal-lang
xmonader2 has joined #crystal-lang
A124 has quit [Client Quit]
McSoFake has joined #crystal-lang
Qchmqs has joined #crystal-lang
j2k has joined #crystal-lang
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
<BlaXpirit> schoening, no, certainly it assigns then checks. in crystal it's always inambiguous whether a name exists in some scope, anyway.
<FromGitter> <schoening> So it's the same as assigning the variable and then performing the check on the next line yes?
<BlaXpirit> schoening, i don't think so. the assigned variable is probably limited to `if`'s scope
bjz_ has joined #crystal-lang
<FromGitter> <schoening> Ah. Thats good stuff to know.
bjz has quit [Ping timeout: 260 seconds]
<FromGitter> <stereosteve> When crystal becomes multi-threaded, will hash access and mutation require a mutex similar to golang?
<FromGitter> <stereosteve> for instance this TimeCache in
xmonader3 has joined #crystal-lang
xmonader2 has quit [Ping timeout: 252 seconds]
xmonader3 is now known as xmonader
xmonader2 has joined #crystal-lang
<BlaXpirit> stereosteve, sure. but you're normally not supposed to concurrently access the same data structure
<Yxhuvud> I imagine people will build threadsafe versions of certain classes.
<FromGitter> <stereosteve> yeah makes sense… it comes up when there's an http server, like the TimeCache example
xmonader has quit [Ping timeout: 260 seconds]
<BlaXpirit> ok what the hell.. i'm running my program, it takes 0m13.580s, then I remove an expensive and frequent print to screen operation and then it takes 0m14.578s
<BlaXpirit> so has anyone tried threaded crystal on linux? i'm having trouble compiling
<BlaXpirit> ah of course, so you need a custom libgc
<BlaXpirit> that's annoying :/
<Yxhuvud> they are using a new one or what?
<BlaXpirit> Yxhuvud, as i understand it, libgc has a compiletime flag for thread support and distros don't set it
<FromGitter> <eliasjpr> @codenoid just need to create an class that includes HTTP::Handler and then do your CORS checks. If you look through the crystal frameworks there are some implementations that have this
McSoFake has quit [Quit: No reason]
<BlaXpirit> Yxhuvud, now it seems like they're actually using a customly modified libgc that isnt published anywhere
<BlaXpirit> ugh
pduncan has quit [Ping timeout: 245 seconds]
<BlaXpirit> why is there no Channel with unlimited buffer size?
pduncan has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 255 seconds]
Philpax has joined #crystal-lang
Philpax_ has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master:
<crystal-gh> crystal/master a8fbfb0 Ary Borenszweig: Fixed #4297: formatter bug with %w{...}
<crystal-gh> [crystal] asterite closed pull request #4297: Fix formatting of String Array literals containing right parens (master...fix_format_string_array_literal_with_paren)
pduncan has quit [Ping timeout: 240 seconds]
<jokke> hi
<jokke> i'm having problems with shards
<jokke> i can't require any shards from my project
<jokke> it says it can't find the file relative to the path of my source
<jokke> i've run shards install of course
<FromGitter> <bew> how do you require them?
<jokke> require "radix"
pduncan has joined #crystal-lang
<jokke> steps to reproduce:
<jokke> crystal init app test
<jokke> cd test
<jokke> echo -n 'dependencies:\n radix:\n github: luislavena/radix\n' >> shard.yml
<jokke> shards install
<jokke> echo 'require "radix"' > src/test/
<jokke> crystal build src/test/
<jokke> # Error in src/test/ while requiring "radix": can't find file 'radix' relative to '/tmp/test/src/test'
<jokke> weird right?
<BlaXpirit> jokke, just check that the shard.yml file is good
<BlaXpirit> if shards.yml outputs othing, it's not working
<BlaXpirit> uhm
<BlaXpirit> if `shards install` outputs othing, it's not working
<jokke> BlaXpirit:
<jokke> so it does seem to work
<BlaXpirit> jokke, do you have a `lib` or `libs` folder?
<jokke> a lib folder
<jokke> it contains radix
<BlaXpirit> jokke, what crystal version?
<jokke> do i have to add it to the load path or something? (not sure there even is such a thing)
<jokke> 0.21.1
<jokke> and shards 0.7.1
<jokke> i'm using crenv
<BlaXpirit> aaah that's probably it lol
<BlaXpirit> i just cannot reproduce
<jokke> ah
<jokke> hmm
<jokke> that kinda sucks :D
<jokke> i thought crenv is pretty widely used already
<BlaXpirit> yeah it's kinda sad that crenv has this reputation - you never know how it will bite you
<BlaXpirit> i've noticed complaints a couple of times
* jokke get's rid of crenv
A124 has joined #crystal-lang
<jokke> aaand there you go
<jokke> works fine without crenv
<jokke> i'll post an issue
<jokke> hm maybe i should try updating crenv first
<jokke> ok works with latest pull
<BlaXpirit> :o
xmonader3 has joined #crystal-lang
xmonader2 has quit [Ping timeout: 240 seconds]
<FromGitter> <KCreate> Is there a method which transforms `{ "foo" => 25, "bar" => 30, "baz" => 30}` into `{ 25 => ["foo"], 30 => ["bar", "baz"]}`
<FromGitter> <KCreate> ?
<FromGitter> <fridgerator> I don't think so
Qchmqs has quit [Ping timeout: 260 seconds]
<BlaXpirit> KCreate, this is silly but here you go
zipR4ND has joined #crystal-lang
Philpax has quit [Ping timeout: 245 seconds]
<FromGitter> <KCreate> ```code paste, see link``` []
<BlaXpirit> im sure it is faster, my suggeston was silly, as noted
<FromGitter> <KCreate> Is this operation actually common enough it be worth adding to the stdlib?
<BlaXpirit> probably not but i can think of some ways of shortening your code
<BlaXpirit> KCreate,
<FromGitter> <KCreate> Cool
<BlaXpirit> in Python world we do it like `n.setdefault(value, []).append(key)`
<FromGitter> <KCreate> The `||=` operator always confuses the hell out of me
<FromGitter> <fridgerator> its great, one of my fav features of ruby / crystal
<BlaXpirit> yeah now that i think about it, im not sure how this even works
<FromGitter> <KCreate> I always explain it to myself like this: if the left side is truthy, do nothing, else set left to the right side
<BlaXpirit> thats good
<Yxhuvud> that paste would be easier to read if the ||= line part was split out to its own line
_whitelogger has joined #crystal-lang
<BlaXpirit> yeah but the ||= thing still remains a mystery
<BlaXpirit> cuz logically it's supposed to expand to `n[value] || (n[value] = [] of String)` but apparently it expands to `n[value]? || (n[value] = [] of String)` or something like that
<FromGitter> <KCreate> doesn't `a ||= b` expand to `a = a || b`
<FromGitter> <KCreate> same as `+=` or `*=`
<FromGitter> <bew> no, it's as BlaXpirit described
<Yxhuvud> kcreate: well. in the case of []= or method= then it won't as it would evaluate the LHS twice.
<Yxhuvud> and the LHS could have side effects
<FromGitter> <KCreate> I remember a commit by @asterite which fixed that exact problem
<FromGitter> <KCreate> or some else i don't remember
<FromGitter> <KCreate> it would put the left side into a temporary variable and thus only evaluate once
<FromGitter> <KCreate> i'll see if i can find it
<BlaXpirit> aha! direct quote from docs `objects[1] ||= 2 # same as: objects[1]? || (objects[1] = 2)`
<FromGitter> <KCreate> well `local || (local = 1)` is the same as `local = local || 1`
<FromGitter> <KCreate> in the case of `local = local` the optimizer would remove it anyway
<FromGitter> <KCreate> and given the above commit, it wouldn't evaluate twice
LastWhisper____ has joined #crystal-lang
<BlaXpirit> KCreate, it's funny that i also reported the issue that this commit fixes
tzekid has joined #crystal-lang
<FromGitter> <eliasjpr> It is possible to create a macro that accepts a block as an argument?
<FromGitter> <bew> yes like a method
<FromGitter> <eliasjpr> like a method?
<FromGitter> <KCreate> do you want the block to be evaluated at compile time or at runtime?
<FromGitter> <eliasjpr> this is the definition of the macro `macro do_stuff(var, &block)`
<FromGitter> <eliasjpr> at runtime
<FromGitter> <KCreate> I don't think that's possible
<FromGitter> <bew> why not?
<FromGitter> <KCreate> because a macro isn't a method
<FromGitter> <bew> do you have an example of what you want to do?
<FromGitter> <eliasjpr> yes
<FromGitter> <KCreate> you can evaluate it at compile time with `{{ yield }}`, but idk about runtime
<FromGitter> <bew> yes but you can paste the block
<FromGitter> <KCreate> yea
<FromGitter> <eliasjpr> okay sorry I really meant at compile time
<FromGitter> <KCreate> then `{{yield}}` is what you're looking for
<FromGitter> <KCreate> you don't need the extra `&block` argument
<FromGitter> <eliasjpr> gotcha
<FromGitter> <eliasjpr> which is the site for sharing crystal code, so I can share with you guys what I am trying to do
<FromGitter> <KCreate>
<FromGitter> <eliasjpr> nvm
<FromGitter> <eliasjpr> thanks
<FromGitter> <KCreate> also works but i think it's the same service under a different domain
<FromGitter> <bew> @KCreate you can't call a block at compile-time
<FromGitter> <KCreate> yes, `{{ yield }}` just pastes the content of the block
<FromGitter> <bew> so @eliasjpr ?
<FromGitter> <eliasjpr> one sec still writing
<FromGitter> <eliasjpr> :)
<FromGitter> <bew> no pb!
cerulean has joined #crystal-lang
<FromGitter> <eliasjpr> here you go, it has some errors
<FromGitter> <eliasjpr> :)
<FromGitter> <eliasjpr> bare with me
<cerulean> hey guys what's the main differences in syntax between crystal and ruby, is there a doc on this?
<cerulean> i dont mean platform/compiler/architectural differences
<FromGitter> <bew> yes
<cerulean> im aware that it's AOT compiled
<FromGitter> <eliasjpr> basically im creating 2 macros that interfaces with 2 specific class methods @bew
<FromGitter> <eliasjpr> because I want those methods available in global scope
<FromGitter> <bew> really, I'm a symbol now ? :D
<FromGitter> <eliasjpr> :)
<FromGitter> <eliasjpr> what can I say
<FromGitter> <bew> :stuck_out_tongue:
<FromGitter> <bew> what should be the type of `@pipeline` ? `Hash(Symbol, Symbol)` or `Hash(Symbol, Array(Symbol))` ?
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <eliasjpr> Hash(Symbol, Array(Symbol))
<FromGitter> <KCreate> btw, try to not abuse macros too much for application logic
<FromGitter> <bew>
<FromGitter> <KCreate> also, you can't use macro arguments as regular arguments. These arguments contain AST nodes. If you want to "paste" them you should use `{{ valve }}` as you did with `{{ pipe }}`
<FromGitter> <eliasjpr> @bew thank you! I wont abuse it
<FromGitter> <eliasjpr> :)
<FromGitter> <KCreate> Is it not possible for `plug` and `pipeline` to be normal methods?
<FromGitter> <bew> yes
<FromGitter> <bew> I'm writing it
<FromGitter> <bew> :)
<FromGitter> <bew>
<FromGitter> <bew> @eliasjpr with defs
<FromGitter> <bew> in a module, so it's the user responsability to eat his top level
<FromGitter> <bew> maybe not perfect, I'm still learning "the crystal way" too ;)
<FromGitter> <KCreate> You can replace ⏎ ⏎ ``` &block``` []
<cerulean> thanks bew its a good document
<FromGitter> <bew> yes, better @KCreate ty
<FromGitter> <KCreate> `block` will pass it as a proc (regular argument), `&block` will try it as a block (available to yield)
<FromGitter> <eliasjpr> yes this is better more modular, I've been having too much fun with macros
<FromGitter> <bew> very nice, I'm not used to inline things like that ( *always sth to learn* )
<FromGitter> <eliasjpr> I would have created this inline method calls in ruby fairly easy, maybe as design guidelines we should state when to use macros
<FromGitter> <bew> @eliasjpr did you see the video from Ary on macros, and how/when to use them?
<FromGitter> <KCreate>
<FromGitter> <eliasjpr> I haven't but I will
<FromGitter> <eliasjpr> Thank you
<FromGitter> <bew> yeah I like to ask before sending the link because it juste paste the player in gitter, and when you're in fullscreen, it just takes the all screen :stuck_out_tongue:
<FromGitter> <KCreate> lol
<FromGitter> <KCreate> yea that's way too big
<FromGitter> <KCreate> i always have it minimized in the corner somewhere
<FromGitter> <KCreate> sry bout that
<Papierkorb> I wish the gitterbot would turn stuff like `: stuck_out_tongue:` into something actually readable, like :P
<FromGitter> <KCreate> isn't the gitterbot also written in crystal?
<FromGitter> <bew> no, gitter is an independant thing
<FromGitter> <bew> it not only exist for crystal
<FromGitter> <KCreate> i know
<FromGitter> <KCreate> i meant the bot
zipR4ND has quit [Ping timeout: 240 seconds]
<FromGitter> <KCreate> which channels all the messages from irc to gitter and back
<FromGitter> <bew> same thing, but yeah it could be cool to have a custom gitter/irc bot in crystal
zipR4ND has joined #crystal-lang
<crystal-gh> [crystal] bew opened pull request #4300: Fix String#each_line documentation (master...fix-string#each_line-doc)
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
zipR4ND has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> if I write `{% puts "hello" %}` it prints `"hello"` (with the quotes) do you know how to get ride of the quotes without boilerplates ?
<FromGitter> <Sija> `{% puts “hello”.id %}`
<FromGitter> <bew> I know that `{% puts "hello".id %}` but I find it kinda ugly to have to put id everytime..
<FromGitter> <Sija> that’s how it is
<FromGitter> <Sija> u can define the var with `id` if u use it moar than once, like `{% var = “hello”.id %}` and then l8r on `{{ var }}`
<FromGitter> <bew> hmm I can understand the "how it is", because it allows to distinguish between compile-time puts and run-time puts, but... yeah ok, it's how it is
<FromGitter> <bew> thanks @Sija
<FromGitter> <Sija> yw
<FromGitter> <Sija> btw, `id` distinguishes between `StringLiteral` and `MacroId` inside macro code
<FromGitter> <Sija> `puts` have nuffin’ to do with it, even tho’ there r two of ‘em: top-level method and macro
<FromGitter> <bew> yeah I just understood that variable assignation in macro system assign ast nodes, like when passing args to a macro, I understand know :)
<FromGitter> <Sija> that’s the thing, over & out ;)
<FromGitter> <bew> yeah I know the diff btw puts and `{% puts %}`
<FromGitter> <bew> nice ty!
tzekid has quit [Quit: tzekid]
<cerulean> woohoo, i'm compiling crystal with crystal on OS X !!!!
<cerulean> if im smart enough and can help with any PRs, i will. dont expect nothin
<cerulean> i DO know ruby and C
<cerulean> ;)
<FromGitter> <codingphasedotcom> for those that want to a look at the ROCKY Stack
<FromGitter> <codingphasedotcom> React Over Crystal Kemal and Yarn
xmonader3 has quit [Ping timeout: 255 seconds]
<FromGitter> <sdogruyol> @codingphasedotcom great name :)
<FromGitter> <sdogruyol> @cerulean welcome :)
<cerulean> thanks sdogruyol. im from ruby/rails community
<FromGitter> <sdogruyol> you're right at home then :)
<cerulean> tthats good :)
<cerulean> one question. is crystal multi-threaded... why not use native thread? just curious
<cerulean> is it the memcpy issue
<FromGitter> <sdogruyol> @cerulean it's currently being worked on by the core team
<cerulean> oh i see. i dont understand the core async model besides that it uses green threads and channels
<FromGitter> <sdogruyol> crystal uses fibers and CSP which is pretty like golang
<FromGitter> <sdogruyol> BTW i've succesfully compiled crystal with multi-thread
<FromGitter> <sdogruyol> there's no doc for now :P
<cerulean> nice
<cerulean> whats CSP?
<cerulean> Channel Service Protocol?
<FromGitter> <sdogruyol> it's a great paper from tony hoare and you should read it :P
<cerulean> OK I will
<cerulean> :)
<cerulean> give me some time
<cerulean> im a busy dude with my own business (on ruby)
<FromGitter> <sdogruyol> hehe it's ok :D
<cerulean> i discovered crystal-lang
<cerulean> just last night
<FromGitter> <sdogruyol> i'm a rubyist too
<cerulean> a friend told me
<cerulean> nice
<FromGitter> <sdogruyol> that's great
<cerulean> ruby gave birth to many languages that MATTER and i view crystal as one
<FromGitter> <sdogruyol> we need more people getting into crystal
<cerulean> :D you have a good ally in me
<RX14> just to add some more perspective, for IO bound workloads, it's faster to implement evented IO on top of fibers than just use OS threads, which is why we have one before the other
<cerulean> crystal/ruby for life !!
<cerulean> i fixed RX14
<FromGitter> <sdogruyol> :)
<cerulean> i use nginx and event machine in my site/bot
<cerulean> im no stranger to it ;)
<cerulean> apache cant even do websockets lmao
<FromGitter> <sdogruyol> then you'll love `spawn`
<cerulean> threads are a relic from the time asynchronous wasn't as good. but i think maybe a thread pool wouldn't be a bad idea. just not 1,000 threads at once
<FromGitter> <sdogruyol> crystal has event driven stuff built-into
<cerulean> what does 'spawn' do? i saw it on the site
<RX14> well thats what we're working on
<FromGitter> <sdogruyol> pretty simple
<cerulean> yeah I figure. I could tell because of the channels stuff
<RX14> crystal will just schedule fibers across a thread pool
<cerulean> yeah thats what event machine does basically
<FromGitter> <sdogruyol> yeah
<cerulean> EM.defer { } isnt that basically a fiber? it happens in another thread after main or something
<RX14> I really think that evented IO should be built into the stdlib though
<cerulean> so your blocking code hangs in a thread properly
<cerulean> i think that should be in crystal probably
<cerulean> are you doing that?
<RX14> the problem with evented io in ruby and python is library support is very hard
<cerulean> to create ? or use? or both
<FromGitter> <sdogruyol> both
<cerulean> i can use EM just fine ... i use it in my IRC bot. it runs a multithreaded IRC connection, Live Twitter Feed API and HTTP server.. i needed help to figure out the syntax. i dont think EM is that complicated. this WOULD be faster in crystal
<cerulean> i know it's got it's drawbacks but i'm happy with the concurrency you can get. but the more complicated and bigger in memory it gets, the slower it gets
<FromGitter> <sdogruyol> this FromIrc bot is written in Crystal btw :P
<cerulean> has anyone done a ruby->crystal translator?
<cerulean> yeah i noticed the bot is very fast
<cerulean> I can come to gitter at any time. I'm @jsilvermdx on github if you wanna look me up
<cerulean> the bot is well done. ive had the idea of this kinda bridge but never did it. i forget it's even a bot. i look at your bolded names
<FromGitter> <sdogruyol> that's cool
<cerulean> is the IRC and Gitter components in the same .cs program?
<cerulean> .cr ?
<FromGitter> <sdogruyol> i think so
<RX14> yeah it's 1 process
<cerulean> incredible
<cerulean> crystal is already insanely good at 0.20
<cerulean> ;D
<RX14> well
<cerulean> i have a versioning system i can apply to your repo and tell you your "true version"
<RX14> evented IO wasn't *that* hard to be honest
<cerulean> also i'm tripping. i could have sworn RX14 you were in Gitter
<RX14> for the amount of gain you get it was relatively trivial
<RX14> i'm on both, I use IRC 99% of the time though
<cerulean> yeah but nobody else has what crystal has. i dont care about evented blahblah. every language has that. but i love the real mission of crystal: ruby syntax, C speed
<cerulean> i've never had a good way to compile my ruby scripts. then crystal showed up im so happy
<cerulean> may the god bless Manas
<cerulean> i'm an LLVM fan as well. i wouldn't use it with no LLVM
<RX14> honestly the evented IO and static typing is what draws me to crystal
<FromGitter> <sdogruyol> @cerulean yeah that's what got me into crystal
<RX14> if it wasn't compiled or was a JVM language... eh I would still use it
<RX14> it's better this way though
<FromGitter> <sdogruyol> it's the best of both worlds
<cerulean> yeah
<cerulean> well combine all of those and its hard to beat
<cerulean> i like the idea of dynamic-style static typing too
<cerulean> Int Cerulean String Cerulean;; Hash Cerulean{arg1, arg2};; /#/ (comment) hey guys use cerulean-lang
<FromGitter> <sdogruyol> yeah, type inference really saves you a lot of time
<cerulean> that was my main draw to ruby and other things
<cerulean> ruby just has really great features, a cut above the rest
<cerulean> the languages above it aren't better, they're just more popular for different reasons like older, more corporate support, exists in all browsers, etc
<RX14> type inference + union types are really the only thing i've ever experienced which gets you close to duck typing but in a statically typed language
<cerulean> without getting into x vs x
<cerulean> RX14: yeah ive never seen it anywhere else
<RX14> the thing I like most aboput ruby is the way it was designed to be read by humans not machines
<FromGitter> <sdogruyol> yeah i forgot union types
<FromGitter> <sdogruyol> i really like union types and they enlightened me about better type systems
<cerulean> it gets past the idea that "Boolean" can't be set to "Nil" because "Nil" is a type, so that's good
<cerulean> beyond that, idk
<cerulean> im new
<cerulean> haha
<RX14> Union types are really the "new" thing in crystal
<cerulean> ruby can still be hard for some programmers because it's very complex in other ways
<FromGitter> <sdogruyol> i love it and also alias <3
<cerulean> capturing the soul of it without implementing EVERYthing was a good design decision
<RX14> everything else in crystal has been "done before" in some language or another I think
<cerulean> has anyone made a program to scan ruby code and help convert it to crystal?
<RX14> i don't think so
<cerulean> i think i might try it after i finish working on my projects and get money
<cerulean> im not thinking auto-convert
<cerulean> im thinking, rubo-cop style, i tell you what in your code won't work for Crystal
<cerulean> check this out
<cerulean> i did the same thing for porting gems to RubyMotion years ago in 2012
<cerulean> the technique isn't hard.
<FromGitter> <sdogruyol> you can kinda write ruby extensions in crystal
<cerulean> ruby can parse ruby. parse it, walk it. look for unsupported stuff. output warning or fix.
<cerulean> well that's good
<cerulean> cause im never touching ruby C api
<cerulean> ;)
<cerulean> Hokkiado can be modified for Crystal
<cerulean> when i figure out the exact feature reduction
<FromGitter> <sdogruyol> cool
<FromGitter> <eliasjpr> @sdogruyol hey hello Eli here. Curious to know if the 60k kemal benchmarks was using multiple processes?
<FromGitter> <sdogruyol> nope that was single process
<FromGitter> <eliasjpr> Mmm... interesting the only way I can get camel to perform over 24k on my machine is if I turn off logging it otherwise I don't get close to your benchmark i know it can definitely be my Dev machine specs
<FromGitter> <eliasjpr> But that's impressive.
<FromGitter> <sdogruyol> it's Kemal :P
<FromGitter> <sdogruyol> for now it's really CPU dependent as there's no multi-threading yet
<FromGitter> <sdogruyol> and that benchmark was for websockets
<FromGitter> <sdogruyol> you need to tweak a lot os specific stuff
<FromGitter> <eliasjpr> ok good to know, I was wondering if I was delusional or something
<FromGitter> <eliasjpr> :)
<FromGitter> <sdogruyol> benchmarking is hard
<RX14> I get about 110k HTTP requests per second per core on my desktop
<FromGitter> <sdogruyol> yeah if you have a high ghz cpu-core
<RX14> so once we get multithreading that should be way better for an average 4 core server
<RX14> that is on linux too BTW
<RX14> not sure how osx fares with networking
<FromGitter> <eliasjpr> 1) 5 GHz Intel Core i7 16 GB 1600 MHz DDR3
<RX14> well my CPU is only 3.8GHz in turbo
<FromGitter> <sdogruyol> :P
tzekid has joined #crystal-lang
<FromGitter> <eliasjpr> any comparisons against phoenix?
<FromGitter> <eliasjpr> :)
<RX14> i'm not sure how phoenix performs
<RX14> but I would guess that it's slower on a single core but would scale better
<FromGitter> <eliasjpr> Slower because is not multithreaded at the moment correct?
<RX14> we'll see
<RX14> erlang has had many many years to tun it's performance
<FromGitter> <sdogruyol> @eliasjpr it's pretty much close
<RX14> @eliasjpr I got 500,000 HTTP requests per second on 7 crystal processes once so you can scale up to multiple cores on crystal just as easilly as nodejs
<RX14> ofc that will improve to be even better than node
<RX14> once we have the new multithread support
<FromGitter> <eliasjpr> 😍
<FromGitter> <eliasjpr> That's awesome
<BlaXpirit> RX14, have u ever tried the multithread branch? do u know how to compile eit?
<FromGitter> <eliasjpr> You guys are doing a fenomenal job with crystal. I can see so many rubyists flooding over to crystal. I was reading the roadmap and it is planned to have a version 1 real ease by the end of the year. How is that looking? Still on target?
<RX14> no I havent BlaXpirit
<RX14> I doubt we'll have v1 by the end of the year, I think it's an unrealistic target. But I'd love to be proven wrong.
<RX14> I'd say maybe 50/50 right now.
<FromGitter> <eliasjpr> where you guys need help?
<RX14> V1 will be released when it's ready
<RX14> @eliasjpr most importantly we need to land parallelism *soon* so that we have loads of time to test it in production.
<FromGitter> <eliasjpr> well if there is anyway I can help let me know, I can make some time to contribute, I also dropped some :hearts:
<FromGitter> <fridgerator> Sounds like they need help with windows support too
xmonader3 has joined #crystal-lang
<FromGitter> <eliasjpr> @fridgerator looking at the github issues
<FromGitter> <KCreate> Maybe a stupid question: Does crystal support returning struct from a method?
<Yxhuvud> yes, but be aware that structs are passed by value.
<FromGitter> <KCreate> yep
tzekid has quit [Quit: tzekid]
xmonader3 has quit [Read error: Connection reset by peer]
xmonader3 has joined #crystal-lang
<FromGitter> <bew> awesome talks since 21h :)
<FromGitter> <fridgerator> ^
xmonader2 has joined #crystal-lang
xmonader3 has quit [Ping timeout: 252 seconds]
xmonader3 has joined #crystal-lang
<FromGitter> <bew> `String#each_line` gives each line of a text WITHOUT the ending `\n` or `\n\r`, is there a way to get the size of the real line (is it `line.size + 1` or `+2` ?)
xmonader2 has quit [Ping timeout: 260 seconds]
xmonader3 has quit [Ping timeout: 260 seconds]
<FromGitter> <KCreate> I don't think so
<FromGitter> <KCreate> you can't possibly be sure if `\n` or `\r\n` was used
<FromGitter> <KCreate> only if you're not the author of the data of course
<FromGitter> <bew> in this case, I'm not
<FromGitter> <bew> I could check before, but wouldn't work for a data stream..
<cerulean> guys remember this: nobody cool uses monokai
<FromGitter> <bew> do you think it'd be a good idea to have a`String#size_with_endline` that could give this info (I'll open an issue to scan others too)
<cerulean> good news. i have crystal-lang head compiled and sublime crystal highlighter installed
<FromGitter> <bew> @cerulean You're read to get to work :)
<FromGitter> <bew> ready*
<cerulean> @bew weeewwwhooo
<cerulean> @bew im just reading crystal files. my main work is still on ruby now but i'm invested. Get in the game !!!
<cerulean> crystal is the unicorn i always wanted
<cerulean> glad to see tech getting truely pushed forward
<FromGitter> <bew> yeaaah me too, I've almost read the all compiler source code, I love the crystal more and more :)
<FromGitter> <bew> -the
xmonader3 has joined #crystal-lang
<cerulean> i should maybe make my own documents on the differences between the languages of ruby and crystal. i really wanna do my gem translator. it would add a huge body of shard to crystal. it was already successful for rubymotion
<cerulean> don't tell me my 18,000 hokkaido downloads are all bots
<cerulean> lol
<cerulean> im reading the samples
<FromGitter> <bew> I wont tell ^^
<cerulean> lol thanks :)
<cerulean> my friend's gem, is a simple CI, it has 29,000 downloads
<cerulean> we figure it really isn't all bots and the bot traffic is minimal
<cerulean> even at 60% bots, its still an impressive amount of downloads
<cerulean> anyway
<cerulean> coming soon to crystal: hokkaido gem translator
<cerulean> i like how says fuck in the filename but f*ck in the output.
<FromGitter> <bew> about tech going forward, some people around me are saying that the language won't go up after some time... I just tell them that if it does, I'll do everything needed to keep crystal up, and rule the world, and as I'm quite good in my school, they already know they're wrong :P
<cerulean> they are wrong because at 10,000 commits, it's already "up"
<FromGitter> <bew> and reaaaaly going forward!
<cerulean> ofc you're good in school man. just watch out for druggies and idiots
<FromGitter> <bew> ahah
<cerulean> i have a versioning system of my own
<cerulean> every 100 comits = +1.0
<cerulean> 9,000 commits is really version 90.0
<cerulean> ;)
<FromGitter> <bew> nice, you just need to commit every line you add :P
<cerulean> rails is truely version 620.0
<FromGitter> <bew> ahah and linux?
<cerulean> version 6330.0
xmonader3 has quit [Ping timeout: 260 seconds]
<FromGitter> <bew> looool
<cerulean> lol
<FromGitter> <bew> the `.0` is important even though it can't change
<FromGitter> <bew> or you did'nt mention how?
<cerulean> can you tell me what "spawn" does again or should i rtfm
<cerulean> it can change
<cerulean> i lied
<cerulean> i used the wrong formula
<cerulean> here
<cerulean> is the real one
<cerulean> from my code
<cerulean> ""v#{(`git rev-list master --count`.to_f) / 100.to_f}"
<cerulean> run that inside the project directory to get my special version number
<FromGitter> <bew> `spawn` creates a new fiber with the block you pass and schedule it, bu you should still rtfm for details :)
<cerulean> kk
<cerulean> thats easy
<cerulean> every commit is actually 0.01 on that scale
<FromGitter> <bew> quite easy^^ go make your first 'awesome' crystal binary for that formula!
<cerulean> this is the real version of linux: 6334.41
<cerulean> lol does crystal support `shel_cmd` style
<cerulean> yes I will
<FromGitter> <bew> make it so that you either exec it in a repo directory, or pass a github url (`user/repo`) still and grab commits info from github api :)
<FromGitter> <bew> s/still/style
<cerulean> is shard a seperate command? i cant locate it
<cerulean> alright
<FromGitter> <bew> yes you have to install it
<cerulean> sounds good :)
<cerulean> how do i install
<FromGitter> <bew> well whats your package manager?
<FromGitter> <bew> if you're on arch I think there is an aur package (I installed it that way) otherwise:
<cerulean> brew
<FromGitter> <bew> follow the link you'll have to install from source
<FromGitter> <bew> oh no, just read you'll see
<cerulean> is it better to use "crystal deps"
<FromGitter> <bew> as stated earlier today, `crystal deps` just run `shards`
<FromGitter> <bew> sooo
<cerulean> oh i see
<cerulean> ;)
<cerulean> yo bew
<cerulean> you still here
<cerulean> how do i get help on a crystal subcommand
<FromGitter> <bew> yeah
<cerulean> sweeeee
<cerulean> crystal deps -h
<FromGitter> <bew> you found with logic :)
<cerulean> i see its only one command
<cerulean> crystal deps -h doesn't work just sayin
<cerulean> it is crystal -h deps
<cerulean> actually no
<cerulean> i lied
<cerulean> nvm
<cerulean> thanks
<cerulean> im good
<FromGitter> <bew> I get ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <bew> okay!
<FromGitter> <bew> it's 1am here, I'll go soon but I still have some ideas I need to write down if I want to sleep (otherwise I just think... until breakfirst ^^)
<cerulean> alright
<FromGitter> <jsilverMDX> i needed my eyes checked - cerulean
<FromGitter> <jsilverMDX> yes, it'strue, my name is Jon
<FromGitter> <jsilverMDX> lol
<FromGitter> <bew> cerulean === @jsilverMDX ?
<FromGitter> <jsilverMDX> yes
<FromGitter> <bew> K
ragmaanir has joined #crystal-lang
<ragmaanir> how do i check whether a class is descended from another or whether a class includes a module?
<FromGitter> <bew> a class ? or an instance of a class?
<ragmaanir> a class
<FromGitter> <bew> at compile time?
<ragmaanir> no
<ragmaanir> runtime is fine
<FromGitter> <jsilverMDX> my guess would be use responds_to? to identify the parent methods. but maybe theres a better way
<FromGitter> <bew> you can't check that at runtime
<FromGitter> <bew> this is compile-time @jsilverMDX
<FromGitter> <jsilverMDX> oh
<ragmaanir> is there a reason for that or is it just not implemented yet?
<RX14> yes you can
<FromGitter> <bew> Oo?
<RX14> >> "ff".class < String
<RX14> nice
<RX14> damn I was sure you could do that
<RX14> oh well
<ragmaanir> yeah, i tried that too ^^ thats how it is in ruby
<RX14> looks like you'd have to use macros
<RX14> no idea why it's not there
<ragmaanir> ok, thx, i think i will have to experiment a little then
<FromGitter> <bew> if you find anything keep us informed!
<RX14> did it
<RX14> <= is subclass or equal
<RX14> < is subclass
<ragmaanir> oh, cool, thx
<RX14> I think that should be a PR personally
<FromGitter> <bew> oh fu**ing nice @RX14 !!
<RX14> i don't see a problem with it currently
<FromGitter> <bew> @RX14 I remember that __wrap_last_expression, it's actually in use (?!) when writing `>> some_crystal`, right? Is there other easter eggs here? :)
<cerulean> i just wrote and ran my first line of crystal
<FromGitter> <bew> *clap* *clap* *clap* !!
<FromGitter> <jsilverMDX> :D ⏎ that code is getting made @bew
<FromGitter> <jsilverMDX> the scope you defined is already written in readme
<FromGitter> <jsilverMDX> lol
<FromGitter> <bew> cool ;)
splitty__ has joined #crystal-lang
splitty_ has quit [Ping timeout: 252 seconds]