LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
VectorGraphics has quit [Quit: Leaving]
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<elorest> I keep seeing class definitions inside of a class definition. What is the point or advantage to this? Are there docs on this anywhere?
<oprypin>
elorest, it's just for namespace purposes. you can also make it private to the class iirc
<oprypin>
i dont think it's ever explicitly mentioned in the docs
<oprypin>
just seems easy to miss for someone who this feels natural to. could be a nice addition to docs
<jack_>
also, the docs say"You can't dynamically create symbols"
<FromGitter>
<sdogruyol> didn't know that
<FromGitter>
<sdogruyol> thanks
<rohitpaulk>
If the keys are finite and well known (they should be, else you probably shouldn't be using symbols), you could maintain a separate mapping from string -> symbol
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter>
<elorest> @bew yes.
<FromGitter>
<crisward> I've complete a few websites now in crystal and the one slight annoyance is having to recompile the code on every template change. Is anyone working on a solution to this? The recompile may only take 10 seconds, but that feels like an eternity when you've only changed something small, eg added a html tag somewhere. Not sure if there are any ways to speed this up, or some kind of run time compilation while in
<FromGitter>
... dev mode?
<FromGitter>
<sdogruyol> @crisward definitely need a non-compile template engine
snsei has joined #crystal-lang
<FromGitter>
<crisward> @sdogruyol any ideas on how this could be achieved? There are obviously parts of the template which contain crystal code, and others which are just strings (ie html), just not sure how they'd be separated. The other possibility is compiling the templates independently and dynamically linking them to the app, again not sure of the implications of this, how fast it would be etc.
rohitpaulk has joined #crystal-lang
snsei has quit [Ping timeout: 245 seconds]
jack_ has quit [Quit: Page closed]
<FromGitter>
<sdogruyol> as of now idk any way to achieve that
<FromGitter>
<sdogruyol> but i'd really love to have that too
Kug3lis_off is now known as Kug3lis
<FromGitter>
<bew> @crisward the independant templates, with linking is a good idea imo, will be fast! No plugin system like this exists currently but it can be done:)
<FromGitter>
<bew> whaat kind of crystal code do you have in your templates?
<RX14>
you could extract each bit of crystal code and turn it into a function
<RX14>
the problem is that it's hard to do reloads then
<RX14>
you reload and the crystal code has changed, now what, you exit?
<RX14>
i guess you'd need another tool which kept running the compiler on exit
<RX14>
it'd be weird to integrate with source watcher tools
<RX14>
but possible i'm sure
<FromGitter>
<sdogruyol> i wonder how other compiled languages handle this
<RX14>
i'd make it mostly abstract from crystal code however
<RX14>
so that the parts that were crystal code were small
<RX14>
don't want to recompile every time you change a for loop
<FromGitter>
<sdogruyol> yeah
<RX14>
and I think other compiled languages just use dynamic templates
<RX14>
or a templating language that can be interpreted
<RX14>
and has a compiler too
<RX14>
which gets you both benefits but not the expressiveness
<RX14>
so it'd be like jinja2 and you'd interpret it in dev and compile it in prod
<RX14>
but thats just a guess i havent actually done research
jhass has quit [*.net *.split]
fmcevoy has quit [*.net *.split]
badeball has quit [*.net *.split]
cyberarm has quit [*.net *.split]
dom96 has quit [*.net *.split]
lhz has quit [*.net *.split]
foca has quit [*.net *.split]
<RX14>
i need to do some benchmarking on crystal-db/crystal-pg I think
<FromGitter>
<sdogruyol> why
<RX14>
crystal doesn't really score all too well on the DB heavy techempower benchmarks
<FromGitter>
<sdogruyol> yeah kinda
<FromGitter>
<sdogruyol> are you still keeping the results private?
zipR4ND has joined #crystal-lang
<RX14>
well they've been having some problems with the continuous benchmarking
<RX14>
that results I showed you was basically how far they got before it broke lol
<RX14>
which happened to include crystal because c was high up in the alphabet
<FromGitter>
<sdogruyol> lol
<RX14>
kemal wasn't on there at all
<FromGitter>
<sdogruyol> :D
<FromGitter>
<sdogruyol> hope they fix it soon
<RX14>
and thats why i didn't want to share it
<RX14>
because it wasn't meant to be really seen
<FromGitter>
<sdogruyol> how did you see it then :P
<RX14>
irc
<FromGitter>
<crisward> @bew I make a call to get a list of pages for a menu, this runs a method on my pages class which returns all page titles and paths with the same parent id from a database.
<FromGitter>
<crisward> @bew but there can be lots of reasons to what to get dynamic data and place it in a template
badeball has joined #crystal-lang
jhass has joined #crystal-lang
dom96 has joined #crystal-lang
cyberarm has joined #crystal-lang
foca has joined #crystal-lang
lhz has joined #crystal-lang
jamie_ca has quit [Ping timeout: 240 seconds]
jamie_ca has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter>
<straight-shoota> @crisward I'm working on an implementation of Jinja2 in Crystal: https://github.com/straight-shoota/crinja It's a dynamic interpreted template engine, so templates can be changed at runtime without recompilation.
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter>
<crisward> @straight-shoota Thanks, will take a look.
Kug3lis is now known as Kug3lis_off
max__ has joined #crystal-lang
max__ is now known as Guest34920
Guest34920 has left #crystal-lang [#crystal-lang]
A124 has joined #crystal-lang
Guest34920 has joined #crystal-lang
Guest34920 has quit [Client Quit]
splitty___ has joined #crystal-lang
yogg-saron has joined #crystal-lang
splitty__ has quit [Ping timeout: 260 seconds]
<crystal-gh>
[crystal] MakeNowJust opened pull request #4486: Semantic: disallow to use return/break/next inside ensure (master...fix/crystal/disallow-control-in-ensure) https://git.io/vHlOp
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yogg-saron has joined #crystal-lang
<crystal-gh>
[crystal] bcardiff closed pull request #4477: Remove enum.cr TODO due to 0.22 released (master...fix/enum/rm-todo-self) https://git.io/vHcfL
<FromGitter>
<invisiwill> Trying to connect to redshift. I'm using the pg shard but that doesn't seem to work. I get a connection refused message - even though the same info connects from the cli. Any ideas?
<FromGitter>
<invisiwill> I was thinking of using the c bindings for postgres or maybe the c bindings for odbc which redshift officially supports odbc and jdbc drivers.
<FromGitter>
<invisiwill> My first attempt was to rewrite the pg shard to work with redshift but after 3 hours of that last night it seems more ambitious than I had time for giving my limited knowledge of crystal and debugging it properly.
<crystal-gh>
[crystal] ysbaddaden pushed 6 new commits to master: https://git.io/vHlKJ
<crystal-gh>
crystal/master 0c6135b Julien Portalier: Use arc4random_buf to fill random bytes on OpenBSD
<crystal-gh>
crystal/master 0538f66 Julien Portalier: Extract Sys::Random from SecureRandom...
<FromGitter>
<sdogruyol> does redshift use the standard postgres protocol?
<FromGitter>
<invisiwill> Yeah, it seems to. Redshift was forked from PG 8 by amazon. You can use the standard pg cli to connect to it.
<FromGitter>
<invisiwill> In Rails there's an AR adapter for Redshift which uses a lot of the same code as the Postgres adapter.
<FromGitter>
<sdogruyol> didnt know that
<FromGitter>
<fridgerator> since there is a different AR adapter, makes me wonder if there are some differences
<FromGitter>
<invisiwill> I was thinking the same thing. But I haven't found the differences yet.
<FromGitter>
<fridgerator> are you using a connection string like `postgres://username:password@hostname/database_name` ?
<FromGitter>
<invisiwill> I think the adapter was more about the differences in data types but it could have connection differences that I didn't spot.
<FromGitter>
<invisiwill> Redshift uses a lot less data types than PG.
<FromGitter>
<invisiwill> Yes, am using the connection string properly. PQ::ConnInfo comes back with the proper data to connect.
<FromGitter>
<fridgerator> ah ok
<FromGitter>
<invisiwill> We are working on building a high speed micro-service in crystal that uses a socket interface to connect with a Rails app so I may end up building a shard for interfacing with Redshift when I get to a deeper understanding of Crystal. Anyways, I'm going to continue digging. If anybody has any ideas ping me. :)
<FromGitter>
<invisiwill> Also, I'll contribute by open sourcing the shard if I can get to that point.
<crystal-gh>
[crystal] akzhan opened pull request #4487: raise(Exception): Setup callstack on raise only if not already set. (master...setup-callstack-on-raise-only-if-not-already-set) https://git.io/vHliY
<Papierkorb>
^ +1
<FromGitter>
<sdogruyol> @invisiwill that's great to hear
<RX14>
so
<RX14>
i managed to link a program on crystal
<RX14>
but it doesn't output to stdout like i intended lol
<FromGitter>
<bew> what do you mean "link a program to crystal" ?
<RX14>
oops
<RX14>
i mean windows
<Papierkorb>
You have to explicitly enable stdin/out on Windows
<FromGitter>
<bew> oh ok
<Papierkorb>
Else it's a "windows" program without output, even if ran on CMD
<RX14>
Papierkorb, how?
<Papierkorb>
it was a linker flag
wontruefree has joined #crystal-lang
<Papierkorb>
You want to choose the "console" subsystem
<Papierkorb>
What linker do you use?
<Papierkorb>
Or are you using mingw as "linker"?
<RX14>
no i'm using link.exe
<RX14>
clang generates an obj file then i link it using the msvc linker
<Papierkorb>
only ever had to deal with mingw, no idea if it does more set up magic
<Papierkorb>
you can also AllocateConsole() i think
<RX14>
windows font rendering is horrendous lol
<FromGitter>
<invisiwill> In case anyone was curious ... changing the startup_params in src/pq/connection.cr seemed to work. Redshift doesn't know what 'application_name' is and doesn't like that utf8 is lowercase. It wants UTF8. The PG shard considers all connection errors to be connection refused. So, just had to add 'e' to that rescue and output the real error.
<RX14>
Papierkorb, i linked it with debug and ran it in the VS debugger
<RX14>
and it seemed to call all the right things
<FromGitter>
<invisiwill> hmmm... might offer up a pr for that error message output fix on pg. that could be helpful for others.
<FromGitter>
<fridgerator> @invisiwill :thumbsup:
mojo has joined #crystal-lang
<FromGitter>
<invisiwill> I will build a redshift shard in the near future now that I could make the pg one work with redshift the other modifications should be fairly simple.
<FromGitter>
<fridgerator> nice
<FromGitter>
<invisiwill> Redshift Speed + Crystal Speed = Blazing fast
<FromGitter>
<fridgerator> :fire:
<FromGitter>
<invisiwill> May also do a benchmark blog post when we get it all working to contribute the info back to the community.
<FromGitter>
<fridgerator> that would be awesome
<Kug3lis>
Hi, is it possible to compile Crystal to Library?
<FromGitter>
<bew> Insane work from from the llvm team, so cool x)
Kug3lis is now known as Kug3lis_off
<FromGitter>
<drosehn> indeed, very nice.
Aytan72 has quit []
Kug3lis_off is now known as Kug3lis
rohitpaulk has joined #crystal-lang
<FromGitter>
<asterite> Hi! I don't understand... we knew that LLVM produced correct windows executables. The main challenge is implementing the std, the bindings to the Windows API, exception handling, etc. LLVM was never a barrier for Windows support as far as I know
<FromGitter>
<asterite> Or am I missing something?
<Papierkorb>
you're not
<FromGitter>
<bararchy> I think the point was " with no modifications" no ? Because until now, there was changes to the compiler which needed to be made in order to produce windows builds
<FromGitter>
<bararchy> right ?
<FromGitter>
<asterite> Yes, to generate exception code for windows, for example. But nothing specific to LLVM other than that. At least the only changes in https://github.com/crystal-lang/crystal/pull/3582 are to the std. For example the context switch in Fiber needs some asm code for each platform
<FromGitter>
<asterite> though I would never reopen Array
<FromGitter>
<asterite> I mean, T.is_a?(Field.class)
<FromGitter>
<elorest> I went with `if T.class.to_s == "Field" `
<FromGitter>
<elorest> @asterite First off I'm honored to have you answer. Secondly what would you do if you wanted to be able to return only visible objects in an array without having to right the select 20 times.
<FromGitter>
<elorest> I tried `class Project::FieldArray < Array` but got an error.