ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
<FromGitter> <Blacksmoke16> ```code paste, see link``` []
<FromGitter> <Blacksmoke16> idk, id be ok with that perf
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ if using a singleton `Crinja` instance []
<straight-shoota> hm, yeah. But how big is the runtime library? Just this single function?
<straight-shoota> If you have more features, it'll make a bigger difference
<straight-shoota> I suppose you could at least re-use that part of the feature library that don't depend on the request context
<FromGitter> <Blacksmoke16> adding more things to the container should in theory slow it down marginally, just by how long it takes to instantiate an object
<FromGitter> <Blacksmoke16> there's deff some things i could do if i went further in the weeds
<straight-shoota> yeah crinja should probably also have some potential for performance optimizations
<straight-shoota> I didn't do much in the direction
<straight-shoota> at least not explicitly
<FromGitter> <Blacksmoke16> i think this was a pretty cool experiment tho. deff is a cool way to handle html view rendering just by returning some format agnostic data from your controller with a custom annotation
<FromGitter> <Blacksmoke16> ill have to look into what does, as it's setup pretty similarly. Maybe they do something special to cache the env or something
<straight-shoota> looks like the symfony integration works similar to your code
<FromGitter> <Blacksmoke16> athena is pretty much based around symfony so that makes sense :P
<straight-shoota> `UrlGeneratorInterface` is bound at the function definition. Not sure what that interface does, tho
<straight-shoota> maybe it's not specific to an individual request
<straight-shoota> nvm, it's the same thing as in your example :D
<FromGitter> <Blacksmoke16> yea :P
<straight-shoota> so you probably know what it's about
<FromGitter> <Blacksmoke16> they later one set that constructor arg to the `router` service from the container
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter> <Blacksmoke16> which is back to reach request has its own container instance
zaltekk has joined #crystal-lang
<zaltekk> hey. i just tried to get crystal 1.0.0 setup for the first time (amd64, linux), and i'm running into an issue with the bin/crystal wrapper script
<FromGitter> <Blacksmoke16> their container stuff is wayy fancier than what i have tho as they can build stuff out at runtime and stuff
<zaltekk> it seems to just continuously spawn `crystal env CRYSTAL_LIBRARY_PATH` processes
<straight-shoota> zaltekk, how did you install crystal?
<zaltekk> i put a symlink in ~/bin to the wrapper script, have ~/bin on my PATH, and run it that way
<zaltekk> straight-shoota: i downloaded the 1.0.0 tarball binary and source, then used the binary to build the source
<straight-shoota> that's what I assumed from the behaviour :D
<zaltekk> was something wrong with that?
<straight-shoota> it seems the bin/crystal from the tar.gz doesn't work well when it's placed in path. I know this is a problem with the bin/crystal from the crystal repo, but that should be a different one
<straight-shoota> could you try what happens if you remove the symlink and call the executable by its path?
HumanG33k has joined #crystal-lang
<zaltekk> it seems to work that way, but i do get "bin/crystal: 153: crystal: not found" before it runs
<zaltekk> which is the line in bin/crystal that contains `crystal env CRYSTAL_LIBRARY_PATH`
HumanG33k has quit [Remote host closed the connection]
<zaltekk> it also looks like the compiler spec failed with a null pointer deref
HumanG33k has joined #crystal-lang
<straight-shoota> ah, I missed that you built the compiler yourself
<straight-shoota> so you placed bin/crystal from the source repo in PATH
<zaltekk> yes, sorry, i used the binary tar.gz to build the source tar.gz
<zaltekk> correct. i added bin/crystal from the binary tar.gz into the path to build the source, then remove it from the path. next i added the built compiler's bin/crystal to ~/bin via a symlink, and ~/bin is on my path
<straight-shoota> so the bin/crystal from the source repo calls `crystal` from path to get some config defaults. Hence it can't be in PATH itself, or needs a different name.
<straight-shoota> You should use the wrapper script from the binary tar.gz, maybe copy it into ~/bin and change the path to point to your local built compiler binary
<zaltekk> i see now that the binary tar.gz had a different bin/crystal. let me try that
<straight-shoota> it's a bit confusing to have to separate but very similar scripts
<straight-shoota> usually only package maintainers have to care about this, though
<zaltekk> that isn't happy either. tries to access ../lib/crystal/bin/crystal, but there isn't a lib/ dir
<FromGitter> <Blacksmoke16> prob easier to install via a package manager at this point :p
<zaltekk> sure, i can just use the binary from the tar.gz, but now i want to figure out why this isn't working
<straight-shoota> yeah, it expects a different dir structure
<zaltekk> i guess step 7 on does say to use `bin/crystal`, but i expected it to be able to be on path
<straight-shoota> bin/crystal from the repo and just comment the recursive line
<straight-shoota> technically it should even be possible to detect if it would call itself
<straight-shoota> most people don't build the compiler themselves and want that as default `crystal` in their path :D
<zaltekk> lol, maybe i'm weird
<straight-shoota> I'm only using bin/crystal with aliases like crystal-master
<FromGitter> <Blacksmoke16> `ccrystal` for the lazy :p
<zaltekk> k, so instead of the wrapper i just took the env vars it sets, added them to my shell rc, and symlinked directly to .build/crystal
<zaltekk> thanks for the help
<zaltekk> now to see if the compiler_spec passes
<zaltekk> nope, still failing
<FromGitter> <grkek> Would it be too extra to add comfy shortcut functions to the HTTP::Server::Context of the STDLIB?
<FromGitter> <grkek> For example a shortcut function to respond with a json response
<FromGitter> <Blacksmoke16> could always just reopen it and add it, but :shrug:
alexherbo2 has quit [Ping timeout: 240 seconds]
f1refly has quit [Ping timeout: 240 seconds]
f1reflyylmao has joined #crystal-lang
f1reflyylmao is now known as f1refly
chachasmooth has quit [Ping timeout: 240 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Ping timeout: 268 seconds]
chachasmooth has joined #crystal-lang
hsh has quit [Quit: Connection closed for inactivity]
DTZUZU_ has joined #crystal-lang
<FromGitter> <grkek> I mean yes but why reopen for every framework
<FromGitter> <grkek> and not have it in a single comfortable manner
DTZUZU has quit [Ping timeout: 246 seconds]
postmodern has joined #crystal-lang
<postmodern> is there a short-hand for converting a Tuple of Float32s to a Tuple of UInt8?
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
<FromGitter> <> postmodern, u know Tuple#map, right?
<postmodern> oprypin, derp. thanks. I guess I was assuming there was some kind of shorthand like tuple as Tuple(Type) or something
_ht has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<straight-shoota> zaltekk, what's the spec error say?
<straight-shoota> @Blacksmoke16 Right before falling asleep, an alternative approach dawned on me. Glad to still remember in the mornin^^
<straight-shoota> You can assign a callable to a variable in the render context. That works like a function.
<straight-shoota> `template.render({"path" =>})`
alexherbo2 has quit [Quit: The Lounge -]
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
Stephie has joined #crystal-lang
<FromGitter> <Blacksmoke16> Oh nice. Thanks!
hsh_ has joined #crystal-lang
<hsh_> hey everyone. basic question: how do I access a file relatively to a spec file? say I have a spec file in `$PROJ/spec/` and from that spec I want to open `$PROJ/spec/assets/test_file.txt`? I can't do a `"./assets/test_file.txt")` IIUC
<_ht> hsh_: maybe it depends on where you run your test from? E.g, if you run crystal spec from $PROJ, you could use
<_ht> "/spec/assets/test_file.txt"?
<FromGitter> <> hsh_, use `__DIR__`
<hsh_> oprypin: thanks!
hsh_ has quit [Quit: Connection closed for inactivity]
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 268 seconds]
ua has quit [Ping timeout: 252 seconds]
ua has joined #crystal-lang
DTZUZU has quit [Ping timeout: 252 seconds]
DTZUZU has joined #crystal-lang
<FromGitter> <adrianpkr_gitlab> Hello. On the front page it reads `# Notice that both Int32 and String respond_to 'to_s'`. Shouldn't that be `respond to`? Or is that a method name?
<FromGitter> <Blacksmoke16> there is a method called `responds_to`, maybe it was renamed at some ponit
<FromGitter> <cdonadeo> @adrianpkr_gitlab Most (maybe all?) have a `responds_to?` method:
<FromGitter> <adrianpkr_gitlab> I see, thanks. Without having used Crystal, the statement just seemed a bit obscure. One has to assume the front page is meant for readers not familiar with Crystal.
<FromGitter> <Blacksmoke16> regardless it was probably just a typo in the first place
<FromGitter> <cdonadeo> Understandable. It’s a Ruby-ism, which Crystal takes a lot of inspiration from.
<FromGitter> <adrianpkr_gitlab> Ah, ok. That makes more sense.
_ht has quit [Remote host closed the connection]
<FromGitter> <cdonadeo> I might phase that differently. What they’re trying to say is something like “Both an `Int32` and a `String` have a `to_s` method, so this works."
<FromGitter> <Blacksmoke16> right
sorcus has quit [Ping timeout: 250 seconds]
<FromGitter> <adrianpkr_gitlab> Yes, I guess for Ruby user it makes immediate sense. For me, a verb like "implement" would make more sense.
<FromGitter> <adrianpkr_gitlab> Anyway, it's clear from the code what's being done there. Just thought I'd mention it in case it was a typo :)
<FromGitter> <cdonadeo> Tough call. It reads better as `respond_to` than it does `responds_to?`. But really, I think I’d just not reference the method at all. Or if the point really needs to be made, show usage of the method as part of the example. Wonder if they’d take a PR for website stuff?
<FromGitter> <> but this is :P
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
<straight-shoota> okay, just read the last comment about website stuff :D
oz has quit [Ping timeout: 245 seconds]
f1refly has quit [Ping timeout: 246 seconds]
oz has joined #crystal-lang
f1refly has joined #crystal-lang
oz has quit [Ping timeout: 246 seconds]
deavmi has quit [Ping timeout: 240 seconds]