<FromGitter>
<wontruefree> are there any benchmarks on the performance impact of macros?
<FromGitter>
<Blacksmoke16> extended use would moreso have an impact on compile time
<FromGitter>
<Blacksmoke16> as macros are just expanded into code in place at compile time
<FromGitter>
<wontruefree> that seems like it would make sense I am just curious how much of an impact it would have
jemc has quit [Ping timeout: 255 seconds]
<FromGitter>
<wontruefree> libraries coming out make heavy use of DSLs
<FromGitter>
<wontruefree> I am curious what the impact would be if the projects grows
<FromGitter>
<Blacksmoke16> id imagine, but to what degree would have to test it
<FromGitter>
<wontruefree> looks like when compiling the amber CLI it take about 30% of the compilation time
<FromGitter>
<wontruefree> that does use some macros but I dont know how much
<FromGitter>
<Blacksmoke16> how did you tell?
<FromGitter>
<Blacksmoke16> `--stats` when building or something?
<FromGitter>
<wontruefree> yep
<FromGitter>
<Blacksmoke16> do you know which section it takes place in?
<FromGitter>
<Blacksmoke16> imagine one of the codegen blocks?
<FromGitter>
<wontruefree> I dont know
<FromGitter>
<Blacksmoke16> :P
<FromGitter>
<Blacksmoke16> fair enough
<FromGitter>
<wontruefree> looks like there are only 2 files it happens in
<FromGitter>
<wontruefree> would it make sense to build a web app with one of these DSLs and compile it then expand the macros and compile it and see the difference?
<FromGitter>
<wontruefree> I guess if the dependent libraries all use macros that would not be an accurate test
<FromGitter>
<Blacksmoke16> hard to test iom
<FromGitter>
<wontruefree> yeah I am not sure how to do it accurately
<FromGitter>
<wontruefree> seems like it might have a big impact on compile time
<FromGitter>
<wontruefree> more then I originally thought
<FromGitter>
<girng> @Blacksmoke16 nope. i just wanted to use a global Array alias, but it's actually returning a tuple as well (https://github.com/crystal-lang/crystal-db/issues/97), not an array of values. so honestly, i'll just go back to using a `Tuple` alias and when i need to modify a certain tuple, i'll just create a new one with the way @z64 described earlier. i think i got confused with how arrays work, they don't really
<FromGitter>
... work like Tuples (from my experience)
<FromGitter>
<Blacksmoke16> i then have a controller that inherits from that abstract struct
<FromGitter>
<girng> good lord
<FromGitter>
<Blacksmoke16> since its a child of it, it has access to the `current_user` method that returns the current user obj from the JWT token, sets the owner of the article, and saves and returns it
<FromGitter>
<Blacksmoke16> 💯
<FromGitter>
<girng> and i thought i was learning crystal after a year... guess i'm doing something wrong lmao
<FromGitter>
<Blacksmoke16> haha, its pretty slick i gotta admit
<FromGitter>
<girng> i don't think my codebase has one instance of :: tbh lol
<FromGitter>
<Blacksmoke16> everything just on top level?
<FromGitter>
<girng> yeah, literally just 1 class and tons of methods
<FromGitter>
<Blacksmoke16> welp
<FromGitter>
<girng> LOL
<FromGitter>
<Blacksmoke16> isnt that confusing/hard to manage?
<FromGitter>
<Blacksmoke16> write any tests yet?
<FromGitter>
<girng> well, a couple structs (like Vector2) and 1 class for db.mapping
<FromGitter>
<Blacksmoke16> write any tests yet?
<FromGitter>
<girng> hahah
<FromGitter>
<girng> nope
<FromGitter>
<Blacksmoke16> double welp
<FromGitter>
<Blacksmoke16> you should really do that
<FromGitter>
<girng> well, game will be in closed beta first that's my test lol
<FromGitter>
<Blacksmoke16> like it'll help know that changes you make dont break anything
<FromGitter>
<Blacksmoke16> and is pretty easy
<FromGitter>
<Blacksmoke16> *do et*
<FromGitter>
<girng> are you a pascal case kind of guy?
<FromGitter>
<Blacksmoke16> the language?
<FromGitter>
<Blacksmoke16> never used it
<FromGitter>
<girng> or just abiding to by how crystal syntax is
<FromGitter>
<Blacksmoke16> how do you mean?
<FromGitter>
<girng> haha i mean PascalCase like that
<FromGitter>
<girng> style of writing
<FromGitter>
<Blacksmoke16> well kinda limited as class names have to be pascal case
<FromGitter>
<Blacksmoke16> constants i do as screaming snake
<FromGitter>
<Blacksmoke16> and enum members i do as pascal as well to differentiate them from constants
<FromGitter>
<Blacksmoke16> all started with that shitty website :P
<FromGitter>
<Blacksmoke16> hosted on google drive
<FromGitter>
<Blacksmoke16> that pulled the button values from a google sheet
<FromGitter>
<Blacksmoke16> no that was later version, all hard coded manually :P
<FromGitter>
<girng> ships of what?
<FromGitter>
<Blacksmoke16> game i play
<FromGitter>
<girng> part of eve online?
<FromGitter>
<Blacksmoke16> yea
<FromGitter>
<girng> ohhhh
<FromGitter>
<Blacksmoke16> used to have an in game browser, so clicking those buttons would execute javascript to open an in game mail with to, subject and body pre filled
<FromGitter>
<girng> what year was this just curious?
f1refly has joined #crystal-lang
<FromGitter>
<Blacksmoke16> so people would order ships from me and id buy them, move them, and sell them to them for a markup for profit
<FromGitter>
<Blacksmoke16> hm
<FromGitter>
<girng> you talking about in-game profit or real life money profit?
<FromGitter>
<Blacksmoke16> in game profit
<FromGitter>
<Blacksmoke16> and imma say ~mid 2015
<FromGitter>
<girng> i don't know how eve online works, but i heard real life money can be involved. like how diablo 3 had that real life money auction house. or maybe i'm thinking of a diff game
<FromGitter>
<girng> so your eve online selling/etc "site" is the gateway that drove you into programming?
<FromGitter>
<girng> https://play.crystal-lang.org/#/r/6ca6 i would need to have 5 different methods if i want to return a new tuple for all 5 indexes. is it possible to do it in one method?
<FromGitter>
<straight-shoota> @proyb6 Crystal would pretty much compile instantly if it didn't have its incredibly awesome type inference. A fully typed language like Go and V can avoid expensive semantic code analysis.
<FromGitter>
<straight-shoota> And V seems to be nothing more than a website with a few claims at the moment. There is no code available, nor any detailed information.
<FromGitter>
<straight-shoota> Even if everything's legit, I don't see any compelling arguments for this language compared to Go.
<FromGitter>
<mavu> I don't understand this focus on compile times. Sure, its nice if stuff compiles instantly, or doesn't need to at all, but as long as it takes less than a minute, I'm more than fine with that.
<FromGitter>
<j8r> The compilation takes also a lot of memory
<FromGitter>
<mavu> Its 2019, I have 16gb memory in my 5 year old laptop
<FromGitter>
<Jack30t> my problem is that the crystal tooling is currently incredibly bad, so your only option to reliably check for errors and stuff like that is recompilling, which is very slow
<FromGitter>
<j8r> @mavu that's not about you, the CI is more expensive too
<FromGitter>
<j8r> And also slower
<FromGitter>
<straight-shoota> I don't think CI is a huge issue.
<FromGitter>
<straight-shoota> Speed matters more for immediate developer experience.
<FromGitter>
<straight-shoota> When you make a change in your code, you want to instantly know if it's good.
<FromGitter>
<straight-shoota> Memory is also an issue, obviously. But it's relatively easy to throw more RAM at it, while speeding up processing speed soon hits a limit. Even parallelism probably wont bring huge improvements because many tasks are sequential.
<devil_tux>
how about someone approve my forum post from days ago >.<
devil_tux has quit [Ping timeout: 268 seconds]
sz0 has joined #crystal-lang
Yxhuvud has quit [Ping timeout: 250 seconds]
Jenz has joined #crystal-lang
lucasb has joined #crystal-lang
<FromGitter>
<PlayLights_twitter> Hello! morning all
<FromGitter>
<Blacksmoke16> o/
<Jenz>
Morning
<Jenz>
(Though evening here)
<FromGitter>
<PlayLights_twitter> Im currently defining a method but looks awful
<FromGitter>
<Blacksmoke16> prob could make a macro to do that. like each macro adds a `Validator` struct or something to an array, then on init run all the validators
<FromGitter>
<PlayLights_twitter> Yeah having an array of validators could work, thanks, im going to search for its implementation on rails core btw
<FromGitter>
<Blacksmoke16> np
<Jenz>
Anyone tried this new crystal book?
Dreamer3 has quit [Quit: Computer has gone to sleep.]
Dreamer3 has joined #crystal-lang
Dreamer3 has quit [Client Quit]
<FromGitter>
<PlayLights_twitter> I read the beta version, but I didn't anything too advanced to learn from so I think it is more for new people on the language
<Jenz>
Hmm, ok thanks
<Jenz>
It's pretty expensive (to me), so I'm in doubt
Jenz has quit [Ping timeout: 255 seconds]
ylluminate has joined #crystal-lang
<FromGitter>
<PlayLights_twitter> Maybe we are pointing different books
<FromGitter>
<PlayLights_twitter> do you have a link?
<FromGitter>
<bew> Hmm It's tricky because Int32 in this case is a value..
<FromGitter>
<girng> Oh cause it's in the array lol
<FromGitter>
<bew> In an expression, the type of `0` is Int32 and the type of `Int32` is Int32.class
<FromGitter>
<bew> Yeah inside a literals it's always an expression
<FromGitter>
<girng> @bew what transpired me to create that playground with the Array(Int32).new and [0] (not [Int32]) is from this post: https://github.com/crystal-lang/crystal-db/issues/98#issuecomment-466638140 and I was confused at first because [0] was not showing class, but doing [Int32] does.
<FromGitter>
<girng> From your help, so it does make sense now. They are consistent
<FromGitter>
<girng> I better understand it
<FromGitter>
<girng> I was just confused at first because I used `[0]` instead. Which was an error on my part, should have used `[Int32]`
<FromGitter>
<bew> In this comment, `ItemTuple` is a type (can be used the as a type / a restriction / type annotation) and `ItemTuple2` is a value (of type `Tuple(...)`)
<FromGitter>
<girng> Thank the heavens for `.types` 😆.. I'd be a hot mess
<FromGitter>
<Blacksmoke16> you know you can create a tuple from an array
<FromGitter>
<girng> it's actually quite cool how this Tuple is working on my brain. For example, I've already started mapping the db columns to their index values (their tuple values). For example, `equipped` is index 4, `i_ms` is index `12`. They are slowly getting mapped in my brain like a Hash lookup
<FromGitter>
<Blacksmoke16> assuming you know the types that each element will be
<FromGitter>
<girng> Actually pretty cool IMO
<FromGitter>
<Blacksmoke16> got a sample of using that replace method?
<FromGitter>
<girng> Oh, I was looking at `from` last night, that's cool
<FromGitter>
<Blacksmoke16> but i still think a class/struct would make more sense
<FromGitter>
<Blacksmoke16> then you could just do like `Item.health_percent = xxx`
<FromGitter>
<girng> Yeah me too
<FromGitter>
<Blacksmoke16> or even implement a method to convert it to/from a tuple
<FromGitter>
<girng> But I tried that, and wrote out all the types in db.mapping, wrote custom to_json using io.raw, so the key values are not sent when .to_json is called, etc
<FromGitter>
<girng> Had a problem somewhere last night and raged. Just went back to Tuples..
<FromGitter>
<girng> But really, the items are stored in a Hash(Int64, ItemTuple).new.. player can have 100+ items in their inventory. I still think a Tuple would be better, but I could be wrong here
<FromGitter>
<girng> Cleaner code, don't need to use DB.mapping and list all 13 types (will have to add more types to that in the future when adding more db columns). Don't need to a custom to_json method with io.raw, that converts every single property into a delimited `,` list... ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Something like that is what I tried, seems too cumbersome IMO. As the Tuple already gets converted into
<FromGitter>
<girng> Oh, another thing is ItemTuple.types is used for db.query_all `query` as: ItemTuple.types. Then ItemTuple is also used `property items = Hash(Int64, ItemTuple).new`. It just seems like the `ItemTuple` can be used everywhere, it feels powerful
<FromGitter>
<girng> Cool @Blacksmoke16 i'll fiddle around with a Struct later tonight
<FromGitter>
<Blacksmoke16> could also expand on that to have a class method like `from_result_set` where you pass it a result set and it can iterate calling `.read({{ivar.type}})` for each ivar to create an array/single object from the rs
<FromGitter>
<Blacksmoke16> so your db query would magically create objects
<FromGitter>
<girng> I see
lucasb has quit [Quit: Connection closed for inactivity]
<Jenz>
@j8r second link in post has a trailing "-" resulting in 404
<Jenz>
(Logo is cool :D)
<FromGitter>
<j8r> fixed this markdown issue, thanks Jenz
<FromGitter>
<j8r> Sometimes, we have to ask for help for projects that will become greater than us.
<FromGitter>
<j8r> thanks Jenz, I remember to have designed it 2-3 years ago in Inkscape 😄
<Jenz>
With all dem sexy curves of inkscape thing tends to get cool, and potentially extremely awesome
<FromGitter>
<j8r> I strongly believe there is a business on self-hosting. Everyone could have a ready-to-use, cheap ARM board with like 1TB of disk space to host they music, movies, pictures.
<FromGitter>
<dscottboggs_gitlab> Unnecessary? Certainly! But it's also useful
<Jenz>
Especially with many arguments, it can be really useful to show what each arg actually is
<FromGitter>
<j8r> hum, name them properly? lol :)
<FromGitter>
<dscottboggs_gitlab> me and @Blacksmoke16 were talking about an idea I had a while ago to make a query engine based on that... like ⏎ ⏎ ```query where: some_arg, eq: value, sort_by: Columns::Column do |results| ⏎ ... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5c71b471c776985d8f4027f7]
<FromGitter>
<j8r> the example in docs showed by @Blacksmoke16 isn't really good
<FromGitter>
<dscottboggs_gitlab> the last one is pretty nice, `increment value, by: amount`
<FromGitter>
<dscottboggs_gitlab> obviously the types were more descriptive, but there were also more of them and I didn't feel like writing the whole thing out
<FromGitter>
<dscottboggs_gitlab> I just like the freedom to be able to use these sorts of things and I don't see the point in arguing against the availabilty of them, they're great and useful when they come up.
<FromGitter>
<dscottboggs_gitlab> Then again, before writing any crystal I read the gitbook front-to-back and not everyone will do that so I guess it's fair to not want to confuse people as much as possible
<FromGitter>
<j8r> reading is one thing, remembering and properly use is another one
<FromGitter>
<j8r> I'm more with KISS IP - keep it simple, stupid, if possible
<FromGitter>
<j8r> limiting complex (or not) features make the code more homogeneous, simpler and faster compiler with less potential bugs
<Jenz>
I don't think that syntax is complex at all O_o, not confusing either, I guess this is a question of personal taste
<FromGitter>
<j8r> that's why i said, or not complex
<FromGitter>
<dscottboggs_gitlab> he's simply advocating for simplicity, which I respect
<FromGitter>
<j8r> even in the generated docs, the arguments looks weird - and didn't understand the API doc, and I code since 1.5 years in crystal -_-'
<FromGitter>
<j8r> maybe the doc needs to be more explicit on this, dunno
<FromGitter>
<j8r> or perhaps it is - my bad 😅
<FromGitter>
<dscottboggs_gitlab> Yeah, if I use weird syntax like that, I always make an extra note of it in the docs with an example
<Jenz>
I was suprised at first too, but I quickly grew very fond of this. I think it was only recently added to the book, as I haven't seen it there either
<Jenz>
(before now)
<FromGitter>
<dscottboggs_gitlab> Yeah, I don't think it was there when I initially read it...
<FromGitter>
<j8r> at the end I don't really mind
<FromGitter>
<j8r> it's isn't widely used anyway
<FromGitter>
<j8r> Jenz I really appreciate the technological work on myst. But, I'm wondering - what is the main use case, compared to Lua (or TCL cc rkeene) or other scripting languages for instance?
<FromGitter>
<j8r> I'll be really careful to notice there is no comma in method args :|
<Jenz>
In myst we strive for ease of use, not that it's very much so ATM, but we try. There's still loads and loads to be discussed, but we have a working language. I repeat "ATM" as stuff is likely to change, we try to make pattern matching and interpolation as readily avaible as possible: everywhere.
<Jenz>
I've also tried to make it easily embeddable with crystal
<Jenz>
Though I realize there's no docs for the embedding API, so there's no way people are gonna notice haha
<Jenz>
I'll do a demo, sounds like fun
<Jenz>
(Answer to: @j8r)
sagax has quit [Ping timeout: 246 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter>
<j8r> Thanks for the explanations Jenz
<FromGitter>
<j8r> So, versus Lua?
<FromGitter>
<j8r> The main point is it's written in Crystal, maybe better, friendlier features?
Jenz has quit [Ping timeout: 246 seconds]
lunarkitty has joined #crystal-lang
<FromGitter>
<aarongodin> hey all, question about using the HTTP::Client from the stdlib. Is my assumption right that calling a method from that class will halt code execution until the request is complete? Or is it executing that on the event loop or through a fiber internally?
<FromGitter>
<aarongodin> The guide only states that "everything IO related" runs on the event loop, but I don't know if http would be considered "IO"