ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<crystal-gh> [crystal] RX14 closed pull request #2777: JSON Output for Documentation Data (master...feature/json-docs) https://git.io/votE7
<FromGitter> <watzon> gcds_ what do you mean?
<FromGitter> <bew> Don't think so, not yet
<gcds_> nvm now :) In c world there is a __weak keyword which tells linker to ignore this if there is second definition :)
<gcds_> I have started porting STM32 Hal library to Crystal :D
<FromGitter> <watzon> In attempting to port the relevant parts on ActiveSupport to Crystal I'm learning a lot more about Ruby than I knew before
<FromGitter> <watzon> Is the concept of `self.included` not needed in Crystal?
<gcds_> mine is bit different :D I am writing for crystal for embedded processors ;D so my porting is low level register shit :D
<FromGitter> <bew> gcds_ looks cool! I was thinking about arduino stuff but I have other projects first for Crystal^^
<gcds_> arduino is too small :D
<FromGitter> <bew> About doing* arduino stuff with crystal
<FromGitter> <watzon> @bew do you know anything about Ruby's `self.included` and if there is a Crystal parallel or if it's even necessary in Crystal?
<FromGitter> <bew> Yeah that too, but I wanted to try to blink a led at least ^^ for learning purpose at least
<gcds_> thats a blink led for stm32f4
<FromGitter> <bew> @watzon don't know much in ruby sorry, maybe you can use the macro hook `included` ? What's the usecase?
<FromGitter> <bew> Yeah gcds_ I saw the discussion yesterday, good job!
<gcds_> thats just to blink LED :D
<gcds_> now I am trying to port that 1.5gb folder to Crystal
<FromGitter> <watzon> From what I gather, and I'm new to the concept myself, `self.included` is a hook that allows you to perform some action when a module is included in a class
<FromGitter> <bew> Cool how do you test that gcds?
<gcds_> run on cpu :D
<FromGitter> <pnloyd> Is there any documentation for for `crystal build` options? (besides the descriptions shown for `--help`)
<FromGitter> <watzon> Well would you look at that
<FromGitter> <bew> gcds like.. a real one?
<gcds_> yep
<gcds_> I have many dev boards
<gcds_> it even runs on really small ones :D
<FromGitter> <bew> Cool, I only have a arduino uno and RPi2.. very basic kit
<gcds_> get some STM32 nucleo boards
<gcds_> they are under 20$
<FromGitter> <bew> I was about to say "if you need I'd love to help" but I have no idea how ^^
<gcds_> me too... :D
<gcds_> I am learning about Crystal and whole stm32 thing
<gcds_> i am freaking idiot... I am writing small parser for constants and trying to make padding but it does not work... after 10 mins I see my replace \s{2,}...
<travis-ci> crystal-lang/crystal#7acedf8 (master - Can't use `self` in toplevel method (#5227)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/296545523
<DeBot_> https://github.com/crystal-lang/crystal/pull/5227 (Can't use `self` in toplevel method)
<crystal-gh> [crystal] MakeNowJust opened pull request #5237: Skip newline after block arg in paren call (master...fix/crystal/5235-skip-newline-after-block-arg-in-paren-call) https://git.io/vFZ1K
<gcds_> is macro nearest thing to C defined inline functions?
<gcds_> as far from objdump I see its yes :D
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
vivus has joined #crystal-lang
<vivus> Does anybody use the slang templating language?
<vivus> what is the Crystal equivalent of: `before_action :authenticate_user!, except: [:index, :show]` ?
<gcds_> thats framework specific
<vivus> well in this case I am trying to convert Ruby code to Crystal
<vivus> error is: in src/controllers/post_controller.cr:2: no argument named 'except'
Creatornator has joined #crystal-lang
<FromGitter> <drujensen> @vivus-ignis Sorry Amber doesn’t support `except` yet. https://amberframework.org/guides/getting-started/controllers/filters.md#controllers-filters
<FromGitter> <drujensen> you can do `only` instead
<FromGitter> <drujensen> This question is more suited for the Amber channel since its related to that framework
<vivus> so something like: before_action :authenticate_user!, do[:index, :show] ?
<vivus> @drujensen nobody else is speaking here, so im not sure it will be an issue for anybody
<FromGitter> <drujensen> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59fbcece2a69af844b408337]
<vivus> @drujensen : undefined local variable or method 'authenticate_user!' (I am using the Amber auth)
<vivus> neither does authenticate! or user.authenticate! or anything else work
vivus has quit [Quit: Leaving]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
_whitelogger has joined #crystal-lang
gcds_ is now known as Kug3lis_off
snsei has quit [Remote host closed the connection]
<FromGitter> <kazzkiq> How do I make `Process.run` show (or return) the output?
notdaniel has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <aarongodin> @kazzkiq You can pass an instance of IO as the `input` argument
<FromGitter> <aarongodin> or rather, something of type `Stdio`, which can be any of these values
<FromGitter> <aarongodin> `true` might be what you want. That would make the output of Process.run use the IO of its parent process
Creatornator has joined #crystal-lang
notdaniel has left #crystal-lang ["Leaving"]
<FromGitter> <kazzkiq> Will take a look. Thanks
shiro` has quit [Ping timeout: 252 seconds]
Creatornator has quit [Quit: Textual IRC Client: www.textualapp.com]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
qard has joined #crystal-lang
qard has quit [Client Quit]
rohitpaulk has joined #crystal-lang
snsei has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 248 seconds]
lacour has quit [Quit: Leaving]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <bew> Note: Stdio will become an enum on next release
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
claudiuinberlin has joined #crystal-lang
mark_66 has joined #crystal-lang
shankar has joined #crystal-lang
shankar has quit [Remote host closed the connection]
<FromGitter> <watzon> Any way to get and set a property on a class from an included module?
<FromGitter> <watzon> Something like ruby's class_variable_get/set
Papierkorb_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
<FromGitter> <watzon> Like, is something like this at all possible? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59fc325ff7299e8f5368542f]
<Groogy> there is a really hacky way
<Groogy> obj.@ivar = 5
<Groogy> does work
<Groogy> but for what you have there I would just have the attribute assignment be done as a macro and do the self.name = "Gorby" in it
<Groogy> or wait no you can't assign directly to a variable, but you can acess/read it
<FromGitter> <watzon> So basically not possible currently?
Kug3lis_off is now known as gcds_
<Groogy> in the example you give, you provide the accessor methods already
<Groogy> with attr_accessor
<Groogy> it's just called property in Crystal
<Groogy> so yes it is possible
<FromGitter> <watzon> Oops, forgot to change that in the example
<Groogy> Well if you have a method generated by property or a assign_attributes method generated, it still the same end result
gcds_ is now known as Kug3lis_off
<Groogy> exposure to internal variables so you might as well have the property methods as well
<FromGitter> <Rinkana> Morning
rohitpaulk has joined #crystal-lang
<Papierkorb_> watzon, with that API, not possible with super ugly hacks
<FromGitter> <watzon> I figured as much. Just wanted to make sure I wasn't missing anything
<Papierkorb_> In which case you'd be writing Rystal and not Crystal
<FromGitter> <watzon> Hahaha
<Groogy> also like, when is the assign_attributes desirable to use anyway?
<FromGitter> <watzon> Any suggestions on a more Crystaly api?
<Groogy> To initialize a lot of values to something? Why not do that in the initializer or sometihng?
<Papierkorb_> Mass assignment Groogy
<Papierkorb_> Groogy: Because Rails-based APIs are often times funky
<Groogy> I would say make a method that takes exactly the values you want?
<Papierkorb_> "Oh lets just thrash everything into a model, ActiveRecord will just say when it's no good"
<Groogy> person.when_doing_something_funky(val1, val2, val3)
<FromGitter> <watzon> Groogy: For mass assignment and I think that Rails uses it with schemas to add properties to a model
<Papierkorb_> watzon, I'd think about a macro implementing a mapping pattern for this
<FromGitter> <watzon> So basically how Crecto does it?
<Papierkorb_> Would also allow you to say what code is to be used for validation etc.
<Papierkorb_> no idea about crecto beyond it existing
Ven has joined #crystal-lang
<FromGitter> <watzon> Ahh lol. Pretty sure it uses some kind of `schema` method or macro that allows you to define a schema in the model
Ven is now known as Guest33365
<Papierkorb_> You really really really don't want to mirror rubys model API
<Papierkorb_> It simply doesn't translate
<Papierkorb_> That AR is simply inferior to other solutions doesn't help
<FromGitter> <watzon> Personally I just kind of like the idea of having migrations that generate a schema that models look to for properties. I can see the obvious downsides to such an approach, but it really does make defining models super simple
<FromGitter> <watzon> Although maybe a reverse approach would be possible in Crystal?
<Papierkorb_> It's just not possible without ugly method_missing stuff
<Papierkorb_> What's not there can't be inspected
<Papierkorb_> That's already an insane issue with Ruby
<Papierkorb_> With some trickery, I mean, you could do that. But not type-safe at all, so that alone already breaks any nice usage
<FromGitter> <watzon> What about defining everything in the model and then having a tool, like Rails' migration tool, that reads the models and generates a schema based on them rather than the other way around. Then it could check against the previous schema and past migrations and generate migrations for any changes.
<FromGitter> <watzon> I'm just trying to think of a better way to handle models and migrations than currently exists in Crystal
rohitpaulk has quit [Ping timeout: 240 seconds]
<Papierkorb_> Full automatism isn't possible. That way doesn't allow you to define conversions
<FromGitter> <watzon> Conversions?
<Papierkorb_> how would you detect this? `ALTER TABLE RENAME COLUMN foo;`
<Papierkorb_> or a `ALTER TABLE x SET TYPE y TO z USING (...)`
<FromGitter> <watzon> Hmm that's a good point
<FromGitter> <watzon> Didn't think about that
<Papierkorb_> I'm not entirely sure that you want to wrap every single SQL function in existence either, finding the right one sometimes really sucked when using Rails
<Papierkorb_> A small frame around upgrade/downgrade functions should already be everything you need
<Papierkorb_> and those funcs could have helpers for the *most common* operations only (like, add_column). And beyond that, some #execute(sql). If having those helpers at all
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcds has joined #crystal-lang
rohitpaulk has joined #crystal-lang
gcds has quit [Client Quit]
<FromGitter> <yxhuvud> upgrade/downgrade and versions table to know which migrations to run.
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
gcds has joined #crystal-lang
mbarbar has joined #crystal-lang
Guest33365 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest30134
Guest30134 has quit [Client Quit]
qard has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 246 seconds]
Hates_ has joined #crystal-lang
<FromGitter> <sdogruyol> just learnt that Kotlin team has 40 full time employees
<FromGitter> <sdogruyol> can't imagine what we'd achieve with that much humanpower :O
<FromGitter> <bew> Oh man that would be awesome :D
<FromGitter> <sdogruyol> indeed!
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest43736
Guest43736 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
<FromGitter> <sdogruyol> I really like how they publish a monthly progress report https://dolphin-emu.org/blog/2017/11/03/dolphin-progress-report-october-2017/
<Papierkorb_> yeah they're great
<Papierkorb_> full of banter, trivia and "awzum!". can't get much better than that
<Groogy> What's Kotlin?
<Papierkorb_> a JVM language by the IntelliJ guys
<Hates_> Is the Crystal Weekly newsletter dead?
<FromGitter> <sdogruyol> @Hates_ no, it's just irregular
<Hates_> Ahh ok :) thanks!
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #5238: Fix to keep double quote of symbol in syntax higlight for `crystal docs` (master...fix/crystal-doc/syntax-highlight-symbol-keep-quote) https://git.io/vFnVr
<FromGitter> <drujensen> @watzon Amethyst Model -> Kemalyst Model -> Amber Model attempted that but had little success at it. I was querying the meta-data and doing diffs to perform the migrations. It was additive so non-destructive. However, it was difficult to know what data to copy if someone wanted to rename a column. There were manual steps to make it work and I realized it wasn’t possible to predict the users intent when
<FromGitter> ... they updated the model.
<FromGitter> <drujensen> we ripped all that logic out and went to using `micrate` which is a rails like migration tool
rohitpaulk has quit [Ping timeout: 240 seconds]
d1rewolf has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <faustinoaq> `micrate` is good 👍
d1rewolf has joined #crystal-lang
<ducklobster> Is there a way to determine the name of the method from the {{ @type }} macro?
<Groogy> I kind of did in a rundabout way using method_added but might not work in your circumstance
<FromGitter> <bew> No ducklobster
<FromGitter> <bew> @type is used to get information about the type you're in
<FromGitter> <faustinoaq> > gcds_: is macro nearest thing to C defined inline functions? ⏎ ⏎ gcds_ Maybe you should check @[Inline] Attribute https://crystal-lang.org/docs/syntax_and_semantics/attributes.html 😄
<gcds> faustinoaq thanks :)
<ducklobster> bew: gotcha, thanks
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven is now known as Guest66351
<crystal-gh> [crystal] RX14 closed pull request #5209: Give error if using instance_sizeof on a generic type without type vars (master...instance_sizeof) https://git.io/vFLqd
claudiuinberlin has joined #crystal-lang
d1rewolf has quit [Ping timeout: 264 seconds]
vivus has joined #crystal-lang
<vivus> Hello all
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFnyZ
<crystal-gh> crystal/master eb4fa17 TSUYUSATO Kitsune: Skip newline after block arg in paren call (#5237)...
<FromGitter> <aarongodin> I’m having trouble finding documentation on Spec’s `should` method
<FromGitter> <aarongodin> oh, found it :P
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <aarongodin> Seems like expectations.cr could use some documentation notes https://crystal-lang.org/api/0.23.1/Spec/Expectations.html#expect_raises-macro
<vivus> how is the gitter and IRC connected here?
d1rewolf has joined #crystal-lang
<FromGitter> <sdogruyol> there's a bot
<FromGitter> <jose-rodrigues> I think they use https://www.npmjs.com/package/irc-bridge-bot combined with the gitter irc integration https://irc.gitter.im/
<FromGitter> <bew> @aarongodin documentation for Spec stuff is on ots way, will be there on next release iirc!
<FromGitter> <sdogruyol> @jose-rodrigues no, we have our own bot written by @jhass
<FromGitter> <sdogruyol> https://github.com/jhass/DeBot
<vivus> can the bot also attach to the amberframework room?
<FromGitter> <jose-rodrigues> @sdogruyol Ho ok at least I tried. :)
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFnSh
<crystal-gh> crystal/master 3c7ed65 TSUYUSATO Kitsune: Fix to keep double quote of symbol in syntax higlight for `crystal docs` (#5238)
<FromGitter> <eliasjpr> Which is IRC server the crystal exists in?
<FromGitter> <asterite> The irc-gitter bot it this one: https://github.com/oprypin/critter
claudiuinberlin has joined #crystal-lang
<FromGitter> <asterite> DeBot is for evaluating crystal code using carc.in
<FromGitter> <eliasjpr> chat.freenode.net?
<FromGitter> <sdogruyol> @asterite ah you're right, thanks Ary :)
<FromGitter> <asterite> ;-)
<FromGitter> <biezhi> Hi, everybody. 😃
<vivus> is anybody in the amber framework room too on gitter?
mbarbar has quit [Ping timeout: 260 seconds]
<FromGitter> <eliasjpr> <vivus> https://gitter.im/amberframework/amber
<vivus> Can someone create an IRC channel for amber on freenode (or should I) ?
<FromGitter> <bew> @RX14 you're there? I don't get it, what's wrong with my comment? https://github.com/crystal-lang/crystal/issues/5236#issuecomment-341730708
<FromGitter> <sdogruyol> hey @biezhi welcome 👍
<vivus> @faustinoaq you around?
<RX14> @bew i just said
<RX14> we're forking
<FromGitter> <biezhi> Crystal is really wonderful, I love it.
<RX14> @bew the long-running process is started in an entirely different process
<FromGitter> <bew> Oh yes nevermind I thought the top was in toplevel
eliasperez has joined #crystal-lang
<RX14> ...no
<FromGitter> <bew> I'll remove my comment, it's useless
<FromGitter> <bew> (on github)
<RX14> don't
<RX14> removing comments just makes things nonsensical
<RX14> just reply "oh right, my bad" or whatever and move on
eliasperez has quit [Quit: WeeChat 1.9.1]
<FromGitter> <bew> Oh right, my bad, I already removed it... Will remember next time!
<vivus> the language is being forked?
<FromGitter> <sdogruyol> what?
<RX14> no lol
<RX14> vivus, the fork() system call
<vivus> phew
<FromGitter> <fridgerator> haha
eliasjpr has joined #crystal-lang
<FromGitter> <eliasjpr> /msg NickServ
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <eliasjpr> lol
claudiuinberlin has joined #crystal-lang
snsei has joined #crystal-lang
<travis-ci> crystal-lang/crystal#3c7ed65 (master - Fix to keep double quote of symbol in syntax higlight for `crystal docs` (#5238)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/296829765
<DeBot_> https://github.com/crystal-lang/crystal/pull/5238 (Fix to keep double quote of symbol in syntax higlight for `crystal docs`)
snsei has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
ducklobster has quit [Ping timeout: 260 seconds]
<FromGitter> <unreadable> > just learnt that Kotlin team has 40 full time employees
<FromGitter> <unreadable> Well
<FromGitter> <unreadable> They have a bunch of IDE licenses for sale starting from 300 euros
<FromGitter> <unreadable> hence the possibility to pay the entire team
<vivus> anything to not write Java
Guest66351 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <fridgerator> haha
<FromGitter> <bew> Let's write a Java IDE in Crystal and sell it to pay a team to work on crystal x)
<FromGitter> <unreadable> there was a guy proposing to the crystal team to write a project that could generate some budget to improve the them
<FromGitter> <unreadable> or something like this
<FromGitter> <unreadable> reddit stuffs
<d1rewolf> does crystal have any corporate sponsorship? you'd think the sizeable amount of frustrated rubyists out there would lure sponsors...
<Papierkorb_> The thing with OSS is that most think that someone else can pay
<d1rewolf> Papierkorb_: true. although we try to sponsor projects when we can. I've donated a number of large servers to debian over the years
<FromGitter> <unreadable> I always wondered how Crystal would look after being touched by google
<FromGitter> <unreadable> they did a pretty good job on Go
<FromGitter> <faustinoaq> Well, Crystal was born and raised at https://manas.tech/
<Papierkorb_> d1rewolf: I mean, friggin OpenSSL had *severe* issues not a long time ago to keep afloat
<Papierkorb_> d1rewolf: If OpenSSL, whose technology the internet literally runs on, can't get funded, who will?
sz0 has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
<vivus> OpenSSL is hidden software. its like libc or other obscure software. projects like that client-side JS framework (can't recall name) have a decent patreon running (something like 8K a month)
rohitpaulk has joined #crystal-lang
faustinoaq_ has joined #crystal-lang
<FromGitter> <unreadable> The syscall is handled in crystal via libc, right?
<faustinoaq_> Hi community, I'm on IRC too :)
qard has joined #crystal-lang
<d1rewolf> is there a roadmap to 1.0 somewhere?
Ven has joined #crystal-lang
Ven is now known as Guest27335
<vivus> welcome faustinoaq_
mark_66 has quit [Remote host closed the connection]
<faustinoaq_> Any recommended desktop client for IRC?
d1rewolf has quit [Ping timeout: 248 seconds]
<vivus> hexchat
<robacarp> what platform? I know several people use textual on mac. I'm a weechat man myself
d1rewolf has joined #crystal-lang
<vivus> or weechat
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 264 seconds]
greengriminal has joined #crystal-lang
<d1rewolf> if I launch a subprocess in `` in a spawn'd fiber, is there a simple way to kill it?
<FromGitter> <Shalmezad> If you had the pid, probably.
<d1rewolf> Shalemezad: so echo the PID back to the spawning process? that might be doable. let me try that
<d1rewolf> what is `` an alias for?
<FromGitter> <Shalmezad> Give me a sec, had it up when I was digging through to see what was causing the issue.
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d1rewolf> Shalemezad: ok, great, thanks
stephenwithav has quit [Ping timeout: 246 seconds]
stephenwithav has joined #crystal-lang
stephenwithav has joined #crystal-lang
stephenwithav has quit [Changing host]
d1rewolf has quit [Ping timeout: 264 seconds]
<FromGitter> <maxpert> Hey guys I am benchmarking the amount of parallel connections I can open with websockets
<FromGitter> <maxpert> Using a basic echo back I can see memory taken for 5K connections is 317MB
<FromGitter> <maxpert> Problem is when I disconnect all these connections
<FromGitter> <maxpert> I can see memory gradually dropping to around 198MB
<FromGitter> <maxpert> but it doesn't go below that
<FromGitter> <sdogruyol> @maxpert do you clean the connections or not?
<FromGitter> <maxpert> @sdogruyol how would I do that
<FromGitter> <maxpert> I had similar hunch
<FromGitter> <maxpert> sorry I am n00b :P in crystal world yet
<FromGitter> <maxpert> have done ruby and golang before so trying it out
<FromGitter> <sdogruyol> do you hold the connections in any data structure?
<FromGitter> <maxpert> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59fca5fa2a69af844b44dff4]
d1rewolf has joined #crystal-lang
<FromGitter> <maxpert> I can see all the connections getting cleaned up from ``@@all_sockets``
<FromGitter> <maxpert> since I check it after test is over
<FromGitter> <maxpert> and I get a size of 0
<FromGitter> <maxpert> so ya that is done
<FromGitter> <maxpert> but something is still holding memory
<FromGitter> <asterite> Crystal uses Boehm GC, and it never returns memory back to the OS
<FromGitter> <maxpert> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59fca6b82a69af844b44e582]
<FromGitter> <maxpert> is invocation code
<FromGitter> <unreadable> There should be a method like `drop` or something to manually clear the garbace
<FromGitter> <unreadable> ge..
<FromGitter> <maxpert> @asterite :/
<FromGitter> <maxpert> @unreadable `drop` on socket object?
<FromGitter> <maxpert> or something else?
<FromGitter> <asterite> There's a looong thread about that: https://github.com/crystal-lang/crystal/issues/3997
<FromGitter> <sdogruyol> Boehm is a conservative GC :P
<faustinoaq_> @unreadable, What about GC.free and GC.collect ? https://crystal-lang.org/api/0.23.1/GC.html#free%28pointer%3APointer%28Void%29%29-class-method
<FromGitter> <maxpert> But how would I get Pointer of socket object here?
<FromGitter> <maxpert> free requires a Pointer(void)
<FromGitter> <maxpert> how to get Pointer out of managed object
<FromGitter> <asterite> I think there's nothing you can do about it
<FromGitter> <maxpert> I guess the follow up would be is it just the memory that's not GCed or is it the whole socket object with the file descriptors and everything
<FromGitter> <maxpert> ?
<faustinoaq_> @asterite What's `GC.collect` for ? https://crystal-lang.org/api/0.23.1/GC.html#collect-class-method :)
<FromGitter> <asterite> It runs the GC
greengriminal has quit [Quit: Leaving]
<RX14> the GC obviously garbage collects memory but any memory it frees just gets returned to the GC pool
<RX14> it doesn't get returned to the OS
<RX14> it's also nothing to do with conservative GC
<RX14> you can compile boehm GC with an option to do this
<RX14> but aparrently its buggy and untested
hightower4 has joined #crystal-lang
<RX14> the GC is designed for a fairly constant memory load
<FromGitter> <unreadable> Fautinoq, why does it has to deal with the GC?
<FromGitter> <asterite> A conservative GC just scans the stack and heap and anything that looks like a pointer is not freed. A precise GC is one that frees memory that is known to be related to an allocated object. So a conservative GC is kind of worse. Crystal could have a precise GC but it's too much work
<FromGitter> <unreadable> How does Go handle it?
<FromGitter> <unreadable> I know it's GC collected too, but does it follow the same pattern?
<FromGitter> <asterite> Go is probably precise
hightower3 has quit [Ping timeout: 240 seconds]
<FromGitter> <maxpert> @unreadable Go's GC is more agressive from my experience I was able to handle 10K+ connections on 512MB instance
<FromGitter> <maxpert> no problem
<FromGitter> <maxpert> that's something I will deal with later
<FromGitter> <maxpert> but is there a way to explicitly mark something free?
<FromGitter> <maxpert> I guess not
<FromGitter> <asterite> nope
<RX14> i'd peg go's memory efficiency at it useing split stacks and a custom stack allocation
<RX14> instead of just mmapping and making the OS do the right thing
<RX14> 10000 fibers is 83GiB of virtual memory
<RX14> @maxpert it'd be very unsafe to do so
<FromGitter> <unreadable> well, if you managed to handle it better with go, why did you switch to crystal?
<FromGitter> <unreadable> oO
<FromGitter> <maxpert> @unreadable trying it out and I love ruby syntax
<FromGitter> <unreadable> Was thinking about this
<FromGitter> <unreadable> and I fully agree
<FromGitter> <maxpert> @RX14 what's cost per Fiber?
<FromGitter> <unreadable> 4 or 8kb, depending by the os
<FromGitter> <maxpert> Has anyone tried this in NodeJS?
<RX14> about 2 pages
gcds has quit [Ping timeout: 240 seconds]
<RX14> we allocate 8MiB of virtual stack space and 1 page gets allocated immediately
<FromGitter> <unreadable> Well, I've been working with socket.io and sockjs in Node, but never been so curious
<RX14> and I typically see 4kIb of kernel memory usage per fiber too
<RX14> just for bookkeeping thost mmaps
<FromGitter> <unreadable> @maxpert I like your programming background
<RX14> when i benchmarked loop { spawn { sleep } }
<FromGitter> <unreadable> in terms of languages
<RX14> i saw about 50/50 OS/userspace memory
<FromGitter> <maxpert> @unreadable ya I have explored a lot of landscape due to research nature of my job :)
<FromGitter> <maxpert> @RX14 ok so I still have to read on Bohem GC but there must be a way in GC to say return memory why don't we expose that as part of API
<FromGitter> <unreadable> What are you working at your current job if I may ask u
<FromGitter> <unreadable> 😄
stephenwithav has quit [Ping timeout: 240 seconds]
<RX14> @maxpert there's no such way to do it
<RX14> there's simply no way to return the memory back to the OS
<RX14> there's a ./configure flag but it's experiemental, beta, etc
<FromGitter> <maxpert> @unreadable well this is something I am exploring due to a hobby project; otherwise I am working at Microsoft Research
<FromGitter> <maxpert> @RX14 got it just looking at it
<RX14> in practice its a small problem
<FromGitter> <sdogruyol> @maxpert I've had some time benchmarking websockets against node and Crystal was doing better however this was like 1-2 years ago
<RX14> for server applications its best to keep your peak memory usage in mind
<RX14> we're not using *mkore* memory because of this
<RX14> we're just using it forever
<FromGitter> <maxpert> @RX14 agreed; what took me by surprise was if there is a leak :P
<RX14> well if there's a leak then it'll never get freed to the GC
<RX14> let alone to the OS
<FromGitter> <maxpert> And GC.collect is blocking right?
<RX14> yeah
<RX14> just as much as GC.malloc when we need to run the GC
<FromGitter> <maxpert> Ok so I did a crazy experiment of running `GC.collect` like 1000 times from an API
<FromGitter> <maxpert> just to make sure I force collect everything
<FromGitter> <maxpert> guess what is difference
stephenwithav has joined #crystal-lang
stephenwithav has joined #crystal-lang
stephenwithav has quit [Changing host]
<FromGitter> <sdogruyol> lol
<RX14> none?
<FromGitter> <maxpert> :P
<RX14> GC.stat will show you the GC has a big heap
<FromGitter> <maxpert> @RX14 you understand GC really well
<FromGitter> <maxpert> :D
<RX14> but nothing will change as far as the OS can see
<RX14> yeah I try to understand crystal well lol
<RX14> i've seen a lot of things in this channel
<FromGitter> <maxpert> @RX14 I am wrapping my head around it yet :P
greengriminal has joined #crystal-lang
<FromGitter> <maxpert> but I think the amortized memory for 5K connections should remain same
<FromGitter> <maxpert> i.e. it should never go beyond ~300MB figure
claudiuinberlin has joined #crystal-lang
<RX14> if you hold 5k connections it should be a constant memory
<RX14> when you stop holding those 5k a bunch of fibers will exit
<RX14> and the memory associated with the fiber stacks will slowly reach 0
Kug3lis_off is now known as gcds_
<RX14> but the memory associated by memory those fibers allocated on the heap will stay
<RX14> if you hold another 5k
<RX14> the memory usage should be the same
<RX14> the peak memory should be the same it just wont return to nearly the startup memory before any connections came
<FromGitter> <maxpert> @RX14 the top peak remains same
<FromGitter> <crisward> @asterite it can if you compile it with a flag - that's how we've been using it since January. Works well.
<FromGitter> <maxpert> @crisward what are you using it for?
<FromGitter> <crisward> return memory to the os, that is.
<RX14> cool
<vivus> is anybody from Amber channel around?
<FromGitter> <maxpert> I mean what kind of use case?
<FromGitter> <faustinoaq> vivus: try #aamberframework
<FromGitter> <faustinoaq> 1) #amberframework
faustinoaq_ has left #crystal-lang [#crystal-lang]
faustinoaq has joined #crystal-lang
<d1rewolf> I believe I've identified another bug. can someone else try this? https://github.com/crystal-lang/crystal/issues/5240
<vivus> thanks faustinoaq
gcds_ is now known as Kug3lis_off
<d1rewolf> crap...this one is really a blocker for me
jplatte has left #crystal-lang ["User left"]
Kug3lis_off is now known as gcds_
<FromGitter> <crisward> Just websites - eg http://www.duodesign.co.uk
d1rewolf has quit [Ping timeout: 258 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
d1rewolf has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
Hates_ has quit [Quit: Connection closed for inactivity]
gcds_ is now known as Kug3lis_off
Guest27335 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis_off is now known as gcds_
gcds_ is now known as Kug3lis_off
<FromGitter> <aarongodin> Hey all, I’m having a trouble understand a compiler error I’m receiving. Would anyone mind taking a look? https://gist.github.com/aarongodin/a639e62aac1f3bbd93ed175c03c29071
<FromGitter> <aarongodin> Oh my gitter put the whole thing in there, alright :D
<FromGitter> <aarongodin> Is there something I can do to props to cast it correctly?
<FromGitter> <unreadable> Maybe `.as(Type)` method
<FromGitter> <aarongodin> The issue there is that I can’t cast to a union type, which is what JSON::Type is
<FromGitter> <maxpert> did same benchmark on Node.js :P < 100MB of memory
<FromGitter> <aarongodin> Maybe there is another way to get the same result, since I think what I’m doing also doesn’t make sense
<FromGitter> <luislavena> @unreadable the problem is that `{"test" => "test"}` is a `Hash(String, String)`
<FromGitter> <luislavena> If you want that be a `JSON::Type`, first top-level method works because Hash(String, String) conforms the signature for JSON::Type
<FromGitter> <luislavena> however, passing that to an instance variable, doesn't which is why the compiler fails.
<FromGitter> <luislavena> @unreadable https://play.crystal-lang.org/#/r/30y0
<faustinoaq> > did same benchmark on Node.js :P < 100MB of memory
<faustinoaq> @maxpert What benchmark?
ducklobster has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
<FromGitter> <unreadable> Well done Node
<FromGitter> <unreadable> Did you use any framework or the http standard module?
d1rewolf has quit [Ping timeout: 248 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
alex`` has quit [Ping timeout: 252 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
d1rewolf has joined #crystal-lang
greengriminal has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
eliasjpr has quit [Ping timeout: 258 seconds]
<crystal-gh> [crystal] asterite opened pull request #5241: Syntax: fix incorrect handling of "%w(" (master...bug/5239-untermined-string-array-literal) https://git.io/vFcgF
Guest72603 is now known as waveprop
waveprop has quit [Changing host]
waveprop has joined #crystal-lang
eliasjpr has joined #crystal-lang
sz0 has joined #crystal-lang
eliasjpr has quit [Ping timeout: 252 seconds]
eliasjpr has joined #crystal-lang
eliasjpr has quit [Ping timeout: 255 seconds]
eliasjpr has joined #crystal-lang
eliasjpr has quit [Ping timeout: 255 seconds]
eliasjpr has joined #crystal-lang
eliasjpr has quit [Ping timeout: 264 seconds]
Kug3lis_off has quit [Read error: Connection reset by peer]
<vivus> anybody lurking?
<FromGitter> <crisward> I'm ere... Need to add errors to my mailer lib. Not sure if to have a callbacks or raise exceptions. Raising feels a bit severe, but has the benefit of being 'rescued' further up the call stack. Thoughts anyone?
<FromGitter> <straight-shoota> me to
<FromGitter> <straight-shoota> o
<FromGitter> <straight-shoota> what kind of errors?
<FromGitter> <crisward> the mailer lib talks to mailgun, sendgrid and eventually smtp. If the email can't be sent, because it's malformed, or the upstream service is unavailable, I want to let the sender know.
<FromGitter> <crisward> Crystal db has `query`, which raises and `query?` which returns null if it doesn't find anything. Thinking something like that may be nice. So send, and send?.
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFcMG
<crystal-gh> crystal/master 94480d9 Ary Borenszweig: Syntax: fix incorrect handling of "%w(" (#5241)
<robacarp> I like that
<robacarp> add send! which just raises no matter what
<vivus> this is my question from yesterday concerning amber. I am trying to get my before_action to run, but I cannot figure out which keyword to use for doing this before authentication
<vivus> https://www.zerobin.net/?3d80165ed43fbd7d#2Pnu3KItk+FFy9eswirXQrN/KcmKMCq5sYZKIgBB2qM=
<FromGitter> <crisward> 😆
<FromGitter> <crisward> Not used amber yet... 😟
<FromGitter> <elorest> By why?
<vivus> is there a place I can look for the code relating to authentication?
<FromGitter> <elorest> Yeah. `amber g auth User`
<FromGitter> <elorest> Then just look at the code it generates.
<FromGitter> <straight-shoota> @crisward sounds good
<vivus> @elorest in the controllers/ or handlers/?
<FromGitter> <crisward> @straight-shoota thanks, good to have a second opinion - https://github.com/arcage/crystal-email uses a callback, which feels more js than crystal. Trying to wrap all this stuff in a common api so provider swapping is straight forward.
<FromGitter> <elorest> I believe that it uses a handler.
<FromGitter> <straight-shoota> yes, such a callback does not feel like crystal
<FromGitter> <elorest> I don’t really use before_filters much but here you go. https://amberframework.org/guides/getting-started/controllers/filters.md#controllers-filters
<FromGitter> <elorest> Do you have any examples of code you’re trying to run in the before filter.
<vivus> @elorest yes, the code above is what I am trying to run: https://www.zerobin.net/?3d80165ed43fbd7d#2Pnu3KItk+FFy9eswirXQrN/KcmKMCq5sYZKIgBB2qM=
eliasjpr has joined #crystal-lang
<FromGitter> <elorest> On that last link you’re calling authenticate! but I’m not sure where that method is or what it does.
<vivus> @elorest I am replicating this: https://www.wildacademy.com/tutorials/how-to-build-reddit-with-ruby-on-rails . so currently, my app can post links and content, but it won't show them without logging in, which is what I want
eliasjpr has quit [Ping timeout: 240 seconds]
<FromGitter> <marksiemers> @straight-shoota - Following up to your stack overflow answer (the one with `@@config` and toml) - I didn't think to take your approach (which is a good approach) because older versions of the crystal compiler wouldn't allow the `if something.nil?` check (like here: https://play.crystal-lang.org/#/r/3100) ⏎ Do you know when that change was introduced?
<FromGitter> <marksiemers> It works in the latest of course: https://play.crystal-lang.org/#/r/3101 ⏎ I guess I could manually binary search it
<vivus> I know that @marksiemers likely knows the answer, as I am transpiling rails to amber XD
<RX14> and i duped an email to the mailinglist again...
<RX14> i do it too often
<FromGitter> <marksiemers> Ah, looks like 0.15.0 crystal introduced the `.nil?` change
<FromGitter> <marksiemers> vivus - answer to what? How to deal with before filters with authentication in amber? ⏎ Not off the top of my head, is it possible to see your repo?
<vivus> @marksiemers all my code is the generated code from a few days ago. I am now hacking at it by working backwards. I can provide the steps to reproduce the setup @marksiemers ?
<FromGitter> <marksiemers> Drop it in the amber channel
<travis-ci> crystal-lang/crystal#94480d9 (master - Syntax: fix incorrect handling of "%w(" (#5241)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/297007229
<DeBot_> https://github.com/crystal-lang/crystal/pull/5241 (Syntax: fix incorrect handling of "%w(")
<vivus> @marksiemers our #amber channel on IRC? XD
<FromGitter> <straight-shoota> @marksiemers you *should* definitely use that. nobody uses such an old crystal compiler.
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <marksiemers> Just had to refresh the cache in my brain @straight-shoota !
Kug3lis has joined #crystal-lang
<FromGitter> <marksiemers> FWIW, I updated my answer on there directly people to yours
<FromGitter> <crisward> @elorest it's on my list of things to mess with... I've got as far as reading the docs..
eliasjpr has joined #crystal-lang
eliasjpr has quit [Ping timeout: 260 seconds]
<FromGitter> <elorest> @crisward The docs are coming along nice but the CLI is probably the easiest way to become knowledgable. IMO. But that’s how I learned rails too.
<vivus> I think I found it. the keyword is `context` ? but it still doesn't show the items
<FromGitter> <marksiemers> vivus - what is happening now vs what you want to happen? ⏎ Is it that a post show page - you have to be logged in, and you want that public?
<vivus> @marksiemers from here: https://www.wildacademy.com/tutorials/how-to-build-reddit-with-ruby-on-rails I am attempting to show all content, but yes, as you said, only people logged in can see content
<FromGitter> <marksiemers> vivus - this is one place that amber will diverge a bit from rails. It uses pipelines. ⏎ For your fix look in `src/handlers/authenticate.cr`
<vivus> @marksiemers that's where I found context :P
<FromGitter> <marksiemers> In the `else` if you put `return call_next(context)` without the `if` statement then it will open up your whole site to the public
<FromGitter> <marksiemers> Being able to skip that pipe for certain controller actions, I'm not sure if there is a way to do that yet. If not, it should be a feature request.
<vivus> @marksiemers I think you are right. I need to hack through the authenticate.cr
<FromGitter> <marksiemers> Right now, you just need to come up with a list of public paths and allow those in the pipe, or a list of restricted paths and don't allow those in the pipe
eliasjpr has joined #crystal-lang
<vivus> is it correct to assume that all the paths are restricted?
<FromGitter> <marksiemers> Except the ones in that array: `["/signin","/session","/signup","/registration"]`
eliasjpr has quit [Ping timeout: 240 seconds]
<FromGitter> <marksiemers> Basically, if `return call_next(context)` is executed, it will render the controller action and page as normal
<FromGitter> <marksiemers> If not, then the redirect happens due to the lines of code that follow
<FromGitter> <elorest> I’m working on an authorization example similar to https://github.com/elorest/petergate
<FromGitter> <elorest> Thanks for taking that one @marksiemers