RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
ternarysolo has quit [Ping timeout: 255 seconds]
ashirase has quit [Quit: ZNC - http://znc.in]
ashirase has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #crystal-lang
laaron has quit [Ping timeout: 256 seconds]
laaron has joined #crystal-lang
chemist69 has quit [Ping timeout: 240 seconds]
chemist69 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
marmotini_ has joined #crystal-lang
marmotini_ has quit [Ping timeout: 272 seconds]
rohitpaulk has quit [Ping timeout: 250 seconds]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Ping timeout: 246 seconds]
crystal-lang564 has joined #crystal-lang
<crystal-lang564> does somebody know how parameter are passed to functions, by reference or by value?
marmotini_ has joined #crystal-lang
ashirase has quit [Ping timeout: 250 seconds]
marmotini_ has quit [Remote host closed the connection]
lucasb has joined #crystal-lang
ternarysolo has joined #crystal-lang
ternarysolo has quit [Ping timeout: 272 seconds]
<z64> crystal-lang564: it depends if that type is `Reference` or `Value`
<z64> `Array` is `Reference` (as seen at the top of the page here): https://crystal-lang.org/api/0.27.2/Array.html
<z64> practically, this means whether the object is a `struct` (Value) or `class` (Reference)
<crystal-lang564> OK, got it. Thank's for the explanation
<z64> yw:)
ternarysolo has joined #crystal-lang
ternarysolo has quit [Ping timeout: 250 seconds]
ternarysolo has joined #crystal-lang
faitswulff has joined #crystal-lang
FromGitter has joined #crystal-lang
faitswulff has quit []
crystal-lang564 has quit [Quit: Konversation terminated!]
<FromGitter> <kinxer> Is there a way to use `Benchmark` to benchmark two versions of the same shard?
<FromGitter> <kinxer> I assume I could `shards install` two different versions by giving them different names in my `shard.yml`, but whichever one is `require`d second would overwrite the first one.
<FromGitter> <kinxer> This doesn't work, apparently: https://carc.in/#/r/6i6v
<z64> @kinxer is the scope of your benchmark very large?
<FromGitter> <rishavs> quick question,; i am going through some of my ancient code and trying to make sense why I did something.
<FromGitter> <vladfaust> Well, you really do not rescue anything here https://carc.in/#/r/6i6x
<FromGitter> <rishavs> I had a pretty high opinion of the me that wrote this code, so I thought maybe there was something to it. But guess I was just being dumb. T_T
<FromGitter> <kinxer> @z64 No, it's not. I'm working on a shard to parse and generate GeoJSON, and I want to make sure that the optimization I added actually makes the parsing faster. I decided just to measure the time to parse a small (34 lines) and a large (56 mb) file for each version and then compare.
<z64> @kinxer well what i meant, is if its not that big of a diff then, i would just copy the old implementation and reopen the module/class (if necessary) as `def foo_v1`, etc as needed
<z64> or.. just `checkout` v1, run the bench, then `checkout` v2 and run it :p
<FromGitter> <kinxer> Oh. No, it's a more significant change than that. I thought you were asking about the length of the actual benchmark code. :P
<FromGitter> <kinxer> I'm doing something more similar to the latter.
<z64> nah, by scope i meant like, "how much behavior" were you testing. but yeah. the latter should be fine, running both implementations in the same suite doesn't make a difference, you'll just have to draw your own comparisons from the numbers
rohitpaulk has joined #crystal-lang
<z64> unless you *really* wanted to fork the shard and substitute `SomeScope` for `NewScope` everywhere
<z64> or just do that in a `path:` in shard.yml i guess
<FromGitter> <kinxer> Running the two separately gave a ~1% improvement on the small file, but the ~60% improvement on the large file seems significant enough to keep without going to extra lengths to benchmark it more rigorously.
<FromGitter> <wontruefree> I have been using a few ORMs written in crystal. Does anyone have any thoughts on the best ORMs available? I really like clear so far but it uses a ton of macros which make me concerned about compile time.
<z64> all the ones that i've seen have been a hot mess of macros :p a lot of them do that to strong arm type safety into flexible / expressive things that you expect from orms
<z64> i guess my point is, if thats your concern, i wouldn't expect to escape from it :)
<FromGitter> <wontruefree> so basically all ORMs in crystal are going to go bananas with macros
<FromGitter> <wontruefree> @z64 do you have anything you would recommend for an ORM or database wrapper?
<FromGitter> <vladfaust> https://github.com/drum445/objectify
<FromGitter> <wontruefree> interesting
<FromGitter> <wontruefree> so this lets you handle the queries by hand but does the object mapping and initialization?
<z64> from what i've seen, anyways. consider the concept of an ORM model - you want some class, that represents your database table, with methods on it that reflect the columns - of course the ORM doesn't know about your table, and methods can't be made at runtime so; you need macros that build these models at compile time
<FromGitter> <wontruefree> still has some macros but very little
<FromGitter> <wontruefree> yeah that makes sense
<z64> yeah objectify is neat. honestly though i get by just by using crystal-db and the driver
<FromGitter> <wontruefree> I guess I am asking for something that would not exist
<FromGitter> <wontruefree> I dont know how effective macros will be as a project grows
<FromGitter> <wontruefree> @z64 I will have to try the crystal db driver more :)
<z64> it has DB.mapping (same as JSON.mapping, basically) for reading query results into a type. so typically i'll have `Table.create`, `Table.update`, class methods that do CRUD, and return specific DB.mapping types
<z64> usually i expose a much more specific API though instead of just trying to provide a generic CRUD interface
<FromGitter> <Blacksmoke16> i been working on an annotation version of granite if you wanted to try for the lols
<FromGitter> <Blacksmoke16> but deff not in a state to be actually used
<FromGitter> <wontruefree> I have a small project I would not mind trying it on
<FromGitter> <Blacksmoke16> do you need associations?
<FromGitter> <wontruefree> also crecto seems to not rely on macros alot
<FromGitter> <wontruefree> yep I do
<FromGitter> <Blacksmoke16> would have to manually define those then :P i didnt get to that yet haha
<FromGitter> <wontruefree> haha
<FromGitter> <wontruefree> well I would not mind trying it but I might stop depending on how much time I have
<FromGitter> <Blacksmoke16> but for real, try it out for the lols but deff dont pick it for actual use ;P
<FromGitter> <wontruefree> do annotations have a large compile time overhead?
<FromGitter> <Blacksmoke16> well it still uses macros, but without the frowned upon use of using macros to have mutable constants
<z64> no, they are just a small piece of data attached to an object that a macro can interpret later
<FromGitter> <Blacksmoke16> ^
hightower3 has joined #crystal-lang
<FromGitter> <wontruefree> ah
<z64> can think of it like a "tag" or a "marker" on a class, method, or ivar
<FromGitter> <wontruefree> well I have done some benchmarking of macros but I guess I should get use to them with web frameworks until they become a problem
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/athena 😉
<FromGitter> <wontruefree> I saw this on reddit
<FromGitter> <wontruefree> so this is basically build on macros?
<FromGitter> <Blacksmoke16> every framework is going to have *some* level of macros
<z64> honestly i dont care too much about compile time.. the bigger problem IMO is a lot of macros wind up generating really poor errors when you misuse them if the author isn't considerate of this
<z64> granted there's only so much you can do, depends on the scenario
<FromGitter> <Blacksmoke16> since its a compiled lang there arent many options for defining routes for example w/o macros
<FromGitter> <Blacksmoke16> `{% raise "error" %}` ftw ;)
<FromGitter> <Blacksmoke16> main difference between athena and most other frameworks is the DSL. `get "myRoute/"` vs having a method and adding the annotation
<FromGitter> <Blacksmoke16> each has their pros and cons ofc
<FromGitter> <Blacksmoke16> also personal preference plays a part
rohitpaulk has quit [Remote host closed the connection]
ashirase has joined #crystal-lang
<FromGitter> <Blacksmoke16> and what the project is
ternarysolo has quit [Ping timeout: 245 seconds]
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz> Woah, I like this static-array syntax, and the number generics: https://carc.in/#/r/6i7m
<Jenz> "The generic argument type N is a special case in the type grammar as it doesn't specify a type but a size. Its value can be an Int32 literal or constant."
Jenz has quit [Ping timeout: 246 seconds]
hightower3 has quit [Ping timeout: 245 seconds]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang