ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
<FromGitter> <scottmcclung> hello
<FromGitter> <Blacksmoke16> o/
<FromGitter> <scottmcclung> trying to `shards install` on this git repo https://github.com/imdrasil/kemal_and_jennifer_sample_app and getting this error: `Using db (0.5.1) ⏎ Using carbon (0.1.0) ⏎ Using habitat (0.4.3) ⏎ Failed git log -n 1 108dfae07323805fd8ff8a09007362374c73807b (). Maybe a commit, branch or file doesn't exist?` [https://gitter.im/crystal-lang/crystal?at=5d0d709c5bc3210bb7750259]
<FromGitter> <scottmcclung> any hints on where to look to figure out which package is causing it?
<FromGitter> <watzon> @scottmcclung delete shard.yml and re-run
<FromGitter> <Blacksmoke16> he prob means `shard.lock`
<FromGitter> <watzon> It looks like there's a mismatch. It has habitat listed as a dependency in `shard.lock`
<FromGitter> <watzon> Yes I do
<FromGitter> <watzon> Whoops lol
<FromGitter> <watzon> `shard.lock` should be in the `.gitignore`
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> well depends
<FromGitter> <watzon> Or at least be updated
<FromGitter> <Blacksmoke16> for a lib that is meant to install into other projects no, but for an actual app then yea
<FromGitter> <Blacksmoke16> but yea, should be kept up to date along with the shard.yml file
laaron has joined #crystal-lang
<FromGitter> <scottmcclung> sweet! that was easy thank you!
<FromGitter> <Blacksmoke16> np
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <PlayLights_twitter> Hey hello
<FromGitter> <PlayLights_twitter> Is there any way to change the STDOUT buffer size?
<FromGitter> <Blacksmoke16> dont think so
<FromGitter> <Blacksmoke16> is based on https://crystal-lang.org/api/master/IO/Buffered.html but the size is a constant so you cant really change it
<FromGitter> <PlayLights_twitter> I thought I should flush when I want but it looks like when it's full it automatically flush
<FromGitter> <Blacksmoke16> yea doesnt look like there is a way around it
<FromGitter> <PlayLights_twitter> I have a high performance application, and I feel like writing the logs is making slow the application so
<FromGitter> <Blacksmoke16> might be able to reopen `IO::Buffered` and change the logic there
<FromGitter> <Blacksmoke16> by redefining that method but w/o the auto flusing
<FromGitter> <Blacksmoke16> but ofc that would affect all IOs that include it...
<FromGitter> <Blacksmoke16> but could maybe do like
<FromGitter> <PlayLights_twitter> Yea, that's right
<FromGitter> <PlayLights_twitter> i was thinking about
<FromGitter> <PlayLights_twitter> flushing each 10min
<FromGitter> <PlayLights_twitter> to avoid bottlenecking the application
<FromGitter> <PlayLights_twitter> but I don't know how much size the buffer should have
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d0d89b5d35d4162a878ec06]
<FromGitter> <Blacksmoke16> benchmark it to see if its actually a problem first?
<FromGitter> <PlayLights_twitter> Yea you right, I'm looking for bottlenecks and solving one by one
<FromGitter> <PlayLights_twitter> do you think it's fine 2mb for the STDOUT?
<FromGitter> <Blacksmoke16> I have no idea
<FromGitter> <PlayLights_twitter> Looks like I can't overwrite the constant
<FromGitter> <PlayLights_twitter> ´already initialized constant IO::Buffered::BUFFER_SIZE´
<FromGitter> <robacarp> @PlayLights_twitter write them to redis or something, and then have another client which listens and dumps to the logs
<FromGitter> <robacarp> Or, if you can, just don’t log! 😈
<FromGitter> <Blacksmoke16> oo this would be a good feature for Crylog
<FromGitter> <PlayLights_twitter> @robacarp is like a problem because legal people need it. So you mean a crystal application specific to write logs?
<FromGitter> <robacarp> Aw laws. Ruining the fun.
<FromGitter> <Blacksmoke16> monolog has some neat handlers that do something similar to this
<FromGitter> <Blacksmoke16> ```code paste, see link```
<FromGitter> <Blacksmoke16> and
<FromGitter> <Blacksmoke16> `BufferHandler: This handler will buffer all the log records it receives until close() is called at which point it will call handleBatch() on the handler it wraps with all the log messages at once. This is very useful to send an email with all records at once for example instead of having one mail for every log record.`
<FromGitter> <robacarp> A redis server can handle the throughput, and a secondary app on the Same or alternate server to extract the logs and write to cloud watch or whatever durable store you’re using
<FromGitter> <PlayLights_twitter> Im currently writing the logs to STDOUT and ECS send it to CloudWatch
<FromGitter> <Blacksmoke16> or even publish messages to a queue and process them asynchronously
<FromGitter> <PlayLights_twitter> it has the sync as tru
<FromGitter> <PlayLights_twitter> true
<FromGitter> <PlayLights_twitter> so I think it makes it slow
<FromGitter> <robacarp> @Blacksmoke16 redis for the queue!
<FromGitter> <PlayLights_twitter> I think I can spawn fiber to send it to redis?
<FromGitter> <Blacksmoke16> mosquito for the worker ;P
<FromGitter> <robacarp> o/ if you need it
<FromGitter> <robacarp> A redis blpop would do the trick
<FromGitter> <Blacksmoke16> assuming your app would eventually yield to allow the spawned fiber to execute
<FromGitter> <robacarp> Yeah a high performance app with a plain fiber sounds risky to me
<FromGitter> <Blacksmoke16> i personally like the queue/async idea the best
<FromGitter> <Blacksmoke16> since the logs sound like they're important youd get retry and would store failed ones so you dont lose them
<FromGitter> <robacarp> Rblpoplpush!
<FromGitter> <PlayLights_twitter> yea you right, I can try sidekiq which I'm familiar with from ruby
<FromGitter> <PlayLights_twitter> or what do you think?
<FromGitter> <Blacksmoke16> https://github.com/robacarp/mosquito
<FromGitter> <robacarp> Mosquito but I’m biased 🤤
<FromGitter> <Blacksmoke16> :P
<FromGitter> <PlayLights_twitter> but primary is it faster to send it to an asynchronous worker than writing to STDOUT buffer?
<FromGitter> <Blacksmoke16> dont know
<FromGitter> <Blacksmoke16> sending it to worker would be a `zadd` redis command
<FromGitter> <Blacksmoke16> but youd have to bench mark it
<FromGitter> <Blacksmoke16> but im off to bed for now o/
<FromGitter> <robacarp> Stdout is disk; is slow
<FromGitter> <PlayLights_twitter> intertings
<FromGitter> <PlayLights_twitter> have you see this message before?
<FromGitter> <PlayLights_twitter> GC Warning: Repeated allocation of very large block (appr. size 12742656): ⏎ May lead to memory leak and poor performance
<FromGitter> <robacarp> Nope
alex``` has quit [Quit: WeeChat 2.5]
pracabor is now known as robacarp
<FromGitter> <PlayLights_twitter> Thanks for you help guys
<FromGitter> <PlayLights_twitter> Handling a hight performance application is a complex task
<FromGitter> <robacarp> Divide it however you can, and scale it by that
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<woodruffw> any pointers (sorry) on registering some allocated memory with crystal's GC? i'm writing some bindings for a library that does internal allocations, and i want crystal to take ownership of those allocations
<woodruffw> i'll fall back on creating a duplicate if necessary, just wondering if i'm missing anything
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
teardown has quit [Ping timeout: 245 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
teardown has joined #crystal-lang
<oprypin> woodruffw, i think it doesn't work well like that. either you allocate in crystal or you don't
<oprypin> but i think u can add the pointer as an instance variable to something
<oprypin> nvm, crystal won't even try to deallocate that one, my suggestion would solve the opposite problem
<FromGitter> <dscottboggs_gitlab> woodruffw -- you're looking for `GC.malloc` or perhaps `GC.malloc_atomic` I believe? Unless you're receiving the pointer from a `fun`, in which case, you should use `LibC.free` in a `finalize` method of the class which aquires ownership of the pointer.
_whitelogger has joined #crystal-lang
laaron has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> Doesn't this (https://github.com/crystal-lang/crystal/blob/fbfe8b62f44eca4596090b7580801bd184f73c7a/src/crystal/main.cr#L3) mean that `__crystal_main` is a C function which is defined elsewhere? If so, where is the source for that?
<FromGitter> <dscottboggs_gitlab> I'm just curious. TBH I just found it looking for the event-loop startup.
<oprypin> dscottboggs_gitlab: could very easily be defined by compiler magic. it can't be turtles all the way down
<FromGitter> <dscottboggs_gitlab> why can't it? Crystal supports all of the low-level features of C, even inline assembly. But I take your point that it might not be
<FromGitter> <watzon> Wait, Crystal supports inline assembly?
<FromGitter> <dscottboggs_gitlab> https://crystal-lang.org/api/0.29.0/LLVM/Type.html#const_inline_asm(asm_string,constraints,has_side_effects=false,is_align_stack=false)-instance-method
<FromGitter> <dscottboggs_gitlab> never tried it personally, but the term "inline asm" is in the docs, so I assumed so
<FromGitter> <watzon> Hmm would you look at that
<oprypin> i wouldn't 😂
<FromGitter> <dscottboggs_gitlab> wait so there's just an `asm` function at the top-level? That's awesome haha
<oprypin> yea
<oprypin> it's a keyword the y
<oprypin> tho*
laaron- has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<oprypin> i'm curious, should i just dump all those bugs with compiler's "to_s" functionality? i've been trying to fix them (first batch in https://github.com/crystal-lang/crystal/pull/7886) but i'm burning out waay to fast on messing with the parser
<oprypin> the thing is, it might not be well received just because it's not "fun" or the bugs may not be "realistic" or affecting anyone
moei has quit [Ping timeout: 246 seconds]
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has joined #crystal-lang
lucasb has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
thodoris has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<FromGitter> <r00ster91> imo they should still be fixed
<FromGitter> <r00ster91> maybe someone still hits them someday
<FromGitter> <PlayLights_twitter> Is it fine to wrap code inside a spawn with a rescue to avoid the spawn to crash?
<FromGitter> <PlayLights_twitter> or is a bad practice?
<FromGitter> <PlayLights_twitter> :p
<FromGitter> <r00ster91> I don't think it's good practice to ignore all errors that might happen, you should instead handle them and improve/fix your program
<FromGitter> <r00ster91> to prevent them from happening in the first place
<FromGitter> <PlayLights_twitter> Yeah actually I purpose is to be sure the spawn is running when events occurs, but I should have a log there to see what happened and improve it right?
alex`` has quit [Ping timeout: 268 seconds]
<FromGitter> <r00ster91> yeah probably something like ⏎ ⏎ ```rescue exception ⏎ puts "oh no! #{exception}" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d0e626fbc834f76a4c3cd9e]
alex`` has joined #crystal-lang
<FromGitter> <watzon> *`exception.message`
<FromGitter> <r00ster91> or exception.inspect_with_backtrace
<FromGitter> <watzon> That would be helpful too
<FromGitter> <PlayLights_twitter> never heard `inspect_with_backtrace` before, interesting, thanks guys
<FromGitter> <PlayLights_twitter> about exception, in ruby is not good to use Exception since it could even syntax errors, but in crystal is it fine?
<FromGitter> <r00ster91> I would catch a specific `Exception` like `TypeCastError` to be more clear but if there are various different exceptions then you can leave it as `rescue exception`
<FromGitter> <PlayLights_twitter> Yea, thanks mate
return0e has quit [Ping timeout: 248 seconds]
return0e has joined #crystal-lang
<FromGitter> <tenebrousedge> whew
alex`` has quit [Ping timeout: 244 seconds]
<FromGitter> <tenebrousedge> I think that I've had two days in the last two weeks where I wasn't either traveling or interviewing
alex`` has joined #crystal-lang
moei has joined #crystal-lang
<FromGitter> <tenebrousedge> I feel like I need a week of sleep. But I did evangelize about Crystal with every company that I interviewed with :)
<FromGitter> <watzon> Good job!
<robacarp> fire
<FromGitter> <Blacksmoke16> 🔥 ^
<robacarp> sometimes alfred doesn't spawn fast enough :< i was launching firefox...or trying to
<FromGitter> <PlayLights_twitter> Hey guys do know how to write from one buffer (IO::Buffered) to another (STDOUT)?
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/IO.html#copy%28src%2Cdst%29%3AUInt64-class-method
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron- has joined #crystal-lang
<FromGitter> <PlayLights_twitter> I just created a IO::Buffered but called IO::SuperBuffered (lol), to handle 2mb instead of 2kb
<FromGitter> <Blacksmoke16> :P well there you go ;p
<FromGitter> <PlayLights_twitter> so I want it to write to stdout on its write method when its full, I just don't get the logic
<FromGitter> <PlayLights_twitter> :v
<oprypin> why does it have a fixed buffer size in the first place :o
<FromGitter> <PlayLights_twitter> yea
<FromGitter> <PlayLights_twitter> Just did it, im kind of new on IO's and buffers
laaron- has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <j8r> What is `Exception+` as a type?
<rkeene> So... who is getting their Vlang on ? ;-)
pvn has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> is it out now?
<FromGitter> <dscottboggs_gitlab> @j8r `Exception+` is any type which inherits from `Exception`
<rkeene> VLang was open sourced
<FromGitter> <dscottboggs_gitlab> sweet I'll have to take a look around this week. I'm not super excited about it though. It just seems like a lanugage that implements the features people actually want from Go. Which is cool and all, but I'm not a huge fan of Go besides as an educational tool.
<FromGitter> <dscottboggs_gitlab> Ugh, I wish more languages cared about having nice syntax.
<oprypin> dscottboggs_gitlab, your summary resonates with me :)
<FromGitter> <dscottboggs_gitlab> :)
<FromGitter> <tenebrousedge> I'm really hoping that Crystal will replace Golang
<oprypin> well you shouldnt
<oprypin> just because there's no chance of it happening
<FromGitter> <tenebrousedge> I'm sure all sorts of human suffering is endemic to our condition, but that doesn't mean that one can't hope for its improvement
<FromGitter> <watzon> I hope it will too
<FromGitter> <watzon> I'm sure it won't
<FromGitter> <watzon> But one can hop
<FromGitter> <dscottboggs_gitlab> idk like I said I see go as a DSL for web stuff, and crystal has a lot more potential. There's already work to make a desktop app library, and personally I think the biggest area where Crystal could shine is as a replacement for python in the data science community
<oprypin> V is interesting because it might actually be a usable base for making your own language
<FromGitter> <watzon> Except it's a mess
<oprypin> oh it is?
<FromGitter> <watzon> Yup
<FromGitter> <watzon> Just got released
<FromGitter> <watzon> Almost completely unusable on most people's machines
<FromGitter> <watzon> Although it looks like it just got updated
<FromGitter> <watzon> So I'll try again
<FromGitter> <dscottboggs_gitlab> I've even been thinking about the potential to have a lifetime annotation system as a Crystal DSL using macros and pointers. Not that I could do that right now, but it seems feasible, whereas, with Go, there's no flexibility for adding that sort of thing. No macro system, no templating, no null-safety, the list goes on.
<rkeene> dscottboggs, Have you considered Tcl ? :-D
<FromGitter> <dscottboggs_gitlab> > Except it's a mess ⏎ ⏎ lol I was thinking that might happen 😆
<FromGitter> <dscottboggs_gitlab> rkeene, I have not, should I?
<FromGitter> <j8r> How can I do for a type restriction then?
<FromGitter> <dscottboggs_gitlab> wait, isn't TCL a dynamic scripting language?
<rkeene> dscottboggs, Maybe
<rkeene> :-D
<oprypin> V's source code seems to match my expectations of code style somehow
<rkeene> Tcl is the most dynamic scripting language
<FromGitter> <dscottboggs_gitlab> @j8r a type restriction to `Exception` or to `Exception+`?
<oprypin> but doesnt Tcl have a compiler?
<FromGitter> <j8r> @dscottboggs_gitlab for `Exception+`
<rkeene> oprypin, Yes, you can compile it AOT... it's still a work in progress
<oprypin> cool
<FromGitter> <dscottboggs_gitlab> @j8r I don't think you can..
<FromGitter> <dscottboggs_gitlab> I think you have to use `Exception`
<rkeene> It's pretty impressive since it's more dynamic than JavaScript and AOT compiling JavaScript isn't that popular
<FromGitter> <dscottboggs_gitlab> hm, I'm big on type restrictions so I'm not sure if it's for me, rkeene
<oprypin> dscottboggs_gitlab, u say "have to" as if it's somehow a bad thing
<oprypin> j8r, this `+` is not a real part of the language specification, just some undesirable property of the current implementation. it pops up whenever the compiler suboptimally merges two different subclasses into their base class. but it's never a valid syntax and you shouldn't care about it
<FromGitter> <dscottboggs_gitlab> haha not how I meant it, it piqued my interest
<FromGitter> <dscottboggs_gitlab> yeah I was thinking it was something like that, thanks oprypin
<rkeene> dscottboggs, Nothing stops you from restricting types in Tcl
<FromGitter> <dscottboggs_gitlab> hm
<rkeene> Tcl is so flexible you can build pretty much any language you want out of it
<FromGitter> <dscottboggs_gitlab> I guess that's two more languages I need to research this week, V and TCL
<FromGitter> <watzon> The tcl website makes me sad
<oprypin> nobody has said so far that tcl is actually a good language
<oprypin> it's just impressive :D
<rkeene> I like it, I do all kinds of stuff in it
<rkeene> Check this out: https://rkeene.dev/js-repl/
<oprypin> first time i hear that :)
<FromGitter> <j8r> TCL being a scripting language, it won't match compiled ones
<rkeene> j8r, You can compile Tcl
<FromGitter> <watzon> Lol https://github.com/vlang/v/issues
<FromGitter> <j8r> yes I know, this is a sort of VMs inside
<FromGitter> <watzon> It's been released for like two hours
<FromGitter> <j8r> seems a bit like new compiled Java
<FromGitter> <watzon> Nope
<FromGitter> <watzon> Just tried
<FromGitter> <watzon> It compiles, but that doesn't mean it works
<rkeene> j8r, No, I don't mean the bytecode JIT engine, but you can ahead of time compile it to native machine code using Tcl Quadcode
<rkeene> (It uses LLVM)
<FromGitter> <dscottboggs_gitlab> https://github.com/vlang/v/issues/360 😆
<oprypin> the poor guy is gonna have a long day
<FromGitter> <dscottboggs_gitlab> long week
<oprypin> long life? 🤔
<oprypin> tried to skip the intermediate replies but it's weird then
<oprypin> yeah the issues are a gold mine, realized i shouldnt bother posting links to particular issues
<FromGitter> <dscottboggs_gitlab> TBF it makes sense there would be a lot of little bugs and configuration issues like this. Those comments are just really funny.
<FromGitter> <j8r> compiled tcl is indeed faster than tcl, but I doubt being faster w/ less memory than other languages designed to be compiled
<oprypin> with stuff like this, it's probably dangerous to try to run V lang xD https://github.com/vlang/v/commit/96e15b0f0fd9549783e2c0b3c259d959e0477593
<FromGitter> <dscottboggs_gitlab> yeesh. Yeah I wouldn't try it outside a VM at this stage anyway
<FromGitter> <j8r> that's mad to build a whole new language alone, even more with the will of using any backend (no LLVM or GCC)?
<oprypin> j8r, what do u mean by the last part
<oprypin> https://github.com/vlang/v/issues/367 - oof i can already guess how the REPL is implemented
<FromGitter> <dscottboggs_gitlab> I don't think I understand what I'm looking at here
<FromGitter> <tenebrousedge> well, that's probably the easiest way that I can think of to implement a REPL for a compiled language
<FromGitter> <dscottboggs_gitlab> oh jeeze that's the repl
<oprypin> https://github.com/crystal-community/icr is next level tech compared to that one 👌
<FromGitter> <dscottboggs_gitlab> no but really what is this (https://github.com/vlang/v/blob/96e15b0f0fd9549783e2c0b3c259d959e0477593/compiler/main.v#L809-L811) supposed to be...? `v` is mutable because `.compile()`mutates it....but then the changes are ignored and something happens on an aribtrary file? It looks like multiple REPLs running in parallel will have a race condition on that file
<oprypin> dscottboggs_gitlab, well hey, `crystal eval` has a race condition sooooo
<FromGitter> <dscottboggs_gitlab> oof.
<FromGitter> <dscottboggs_gitlab> ... dare I ask why?
<oprypin> well it has basically this same logic in it
<oprypin> write to hardcoded file path and run it
<FromGitter> <dscottboggs_gitlab> ...but...our stdlib includes `File.tempfile`?
<FromGitter> <dscottboggs_gitlab> and that's like...a part of glibc, so v could call it too
<FromGitter> <dscottboggs_gitlab> oh yeah I remember seeing that thread now. Good work. Did you start on fixes for it or raise an issue?
<FromGitter> <j8r> oprypin I meant https://vlang.io/#faq
<FromGitter> <j8r> Does V use LLVM? ⏎ ⏎ > No. V compiles directly to machine code. It's one of the main reasons it's so light and fast. Right now only x64 architecture/Mach-O format are supported. Once V is open-sourced, other architectures and formats should be implemented relatively quickly.
<FromGitter> <j8r> it emits also C
<FromGitter> <j8r> I'm more looking forward https://ziglang.org/
<FromGitter> <Blacksmoke16> hey, im having some trouble parsing yaml to json from STDIN
<oprypin> j8r, im pretty sure it only emits C and the other parts are BS
<FromGitter> <Blacksmoke16> ` echo '---\nname: Fred' | ./myapp`
<FromGitter> <Blacksmoke16> `puts YAML.parse(STDIN.gets_to_end).to_json`
<FromGitter> <dscottboggs_gitlab> @j8r oof, semicolons
<FromGitter> <Blacksmoke16> `{"---\\nname":"Fred"}` but is what i get
<oprypin> Blacksmoke16, i mean yeah because it's the literal string slash en
<oprypin> thats what you give it
<FromGitter> <dscottboggs_gitlab> yeah use `printf` instead
<FromGitter> <dscottboggs_gitlab> there's an option on echo to do that too
<oprypin> no dont use that one though
<oprypin> i'd prefer `echo $'---\nname: Fred'` then
<FromGitter> <dscottboggs_gitlab> or you could literally do ⏎ ⏎ ```echo '---``` [https://gitter.im/crystal-lang/crystal?at=5d0e9fb31e35ef14b69f0138]
<alex``> hello
<FromGitter> <dscottboggs_gitlab> o/
<FromGitter> <Blacksmoke16> oh ok
<FromGitter> <Blacksmoke16> thanks
<FromGitter> <dscottboggs_gitlab> np :)
<alex``> what is the use of require "foo" looking in "foo/foo.cr" ?
<alex``> do you use it?
moei has quit [Quit: Leaving...]
<FromGitter> <dscottboggs_gitlab> I didn't know that was a thing
<FromGitter> <dscottboggs_gitlab> Is there any way around this aside from making sure the exception gets raised before JSON.build is called? https://carc.in/#/r/73u2
<FromGitter> <dscottboggs_gitlab> it works as I want like this https://carc.in/#/r/73u3
<oprypin> dscottboggs_gitlab, umm u can just write `resp = HTTP::Server::Response.new(mem)` *afterwards*
<FromGitter> <dscottboggs_gitlab> hm...no, this is taken out of something larger. I don't have direct access to the backing IO
<oprypin> i dont understand why you care about the backing IO
<oprypin> doesnt matter. let me just tell you something
<oprypin> i assume that http::server::response is streaming
<oprypin> but you cant write something and then un-write to it if it's streaming
<oprypin> so u cant use streaming, u need to keep the whole thing in memory anyway
<oprypin> so just use https://crystal-lang.org/api/0.23.1/JSON.html#build%28indent%3Dnil%2C%26block%29-class-method to produce a string and write the string to the response, thats it
<FromGitter> <dscottboggs_gitlab> I see, that's an idea. thanks
<FromGitter> <Blacksmoke16> whats the better method of getting the contents of an IO as a string, `to_s` or `gets_to_end`?
<FromGitter> <Blacksmoke16> or something else?
<oprypin> to_s
<FromGitter> <Blacksmoke16> 👍
<oprypin> u basically just look at code
<oprypin> + you need to `rewind` first for gets_to_end (though if you explicitly *don't* want to rewind, then that's what you use)
<FromGitter> <Blacksmoke16> gotcha thanks
pvn has quit [Ping timeout: 246 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <watzon> Interesting, I didn't realize that `#\`` was a command
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <watzon> Anyone want to look over this lexer and see if I'm missing anything important?
<FromGitter> <watzon> I am intentionally leaving out the macro keyword and syntax
<FromGitter> <Blacksmoke16> what about `&.` and `&->`
<FromGitter> <watzon> Ahh good catch
<FromGitter> <watzon> What are those actually called?
<FromGitter> <watzon> Looks like those are handled in the parser actually
<FromGitter> <Blacksmoke16> shortcut syntax afaik
<FromGitter> <watzon> Now it's time to work on the AST
<woodruffw> oprypin & @dscotboggs_gitlab: thanks for the tips. yeah, i'm receiving an already allocated pointer from a `fun`, and `LibC.free` works, was just wondering if there was something cleaner i was missing ;)
<woodruffw> unfortunately i can't make direct use of `finalize` here, since it's not really adding any classes: i'm writing bindings for libCBOR, which should have an almost identical API to the current `JSON.mapping`/`YAML.mapping`