ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
madprops has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
straight-shoota has quit [Ping timeout: 256 seconds]
jhass has quit [Ping timeout: 260 seconds]
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
ur5us has quit [Ping timeout: 246 seconds]
<madprops> what's the point of the specs using the special language instead of doing something like `assert x == 4` or similar?
<FromGitter> <oprypin:matrix.org> madprops, "ruby did it so it must be good", or """it looks like English""". no actual point just nobody second-guesses it
<FromGitter> <oprypin:matrix.org> madprops, you could use https://github.com/search?q=user%3Aoprypin%20spec_assert&type=code
quazimodo has quit [Ping timeout: 264 seconds]
hightower3 has quit [Ping timeout: 256 seconds]
yxhuvud has quit [Ping timeout: 260 seconds]
hightower2 has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
<FromGitter> <revskill10> @naqvis Playground works on 1.7.1 . It also broke on 1.7.0.
<FromGitter> <Blacksmoke16> it was a regression that was fixed in 1.7.1
hightower2 has joined #crystal-lang
fifr_ has quit [Ping timeout: 260 seconds]
fifr has joined #crystal-lang
yxhuvud has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
Flipez has quit [Changing host]
Flipez has joined #crystal-lang
fifr has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
fifr has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
fifr has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
fifr has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
fifr has joined #crystal-lang
fifr has quit [Read error: Connection reset by peer]
fifr has joined #crystal-lang
fifr has quit [Quit: ZNC 1.8.2 - https://znc.in]
hightower2 has quit [Ping timeout: 246 seconds]
fifr has joined #crystal-lang
ur5us has joined #crystal-lang
taupiqueur has joined #crystal-lang
alexherbo2 has joined #crystal-lang
wwalker has quit [*.net *.split]
egality has quit [*.net *.split]
egality_ has joined #crystal-lang
wwalker_ has joined #crystal-lang
wwalker_ is now known as wwalker
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #crystal-lang
hightower2 has joined #crystal-lang
<FromGitter> <lstrzebinczyk> Hi everyone! I'm working on an app and one particular issue about the type system has been bothering me a little bit, I wanted to ask about it. I was going to review issues to see if it's mentioned, but turns out there is 1300 opened issues 😅 . I prepared a code snippet: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ My question is this: Can I mark type of `Builder#inner` to be "The same as
<FromGitter> ... Inner#create" in any way? Typescript has the ability to recover typing of functions with `Parameters`, I was hoping to do something similiar : ). Or also, in typescript I could define `interface`, which I could then use in 2 places. Any advice on what are my options? [https://gitter.im/crystal-lang/crystal?at=63ceff3fcea93403344943b6]
<FromGitter> <Blacksmoke16> so the gist of it is you want the error to point at the `#inner` method and not the constructor of `Inner` itself yea?
<FromGitter> <lstrzebinczyk> yes : )
<FromGitter> <lstrzebinczyk> without defining the types twice
<FromGitter> <Blacksmoke16> id prob just declare the types twice
<FromGitter> <Blacksmoke16> tho i may have a way to make that easier
<FromGitter> <lstrzebinczyk> I see, so currently the language doesn't support pointing to types of other methods?
<FromGitter> <lstrzebinczyk> or defining interfaces, that could then be used?
<FromGitter> <Blacksmoke16> interfaces exist, but wouldnt help in this case since its multiple arguments
<FromGitter> <lstrzebinczyk> what do you refer to?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=63cf023c7740c84e492cf50d]
<FromGitter> <Blacksmoke16> can leverage some metaprogramming to basically auto define the builder method with the constructor args duplicated
<FromGitter> <Blacksmoke16> tho it does make some assumptions, like each type only have 1 constructor
<FromGitter> <lstrzebinczyk> I'm afraid that wouldn't work in my case, though my code snippet might have been a bit misleading. I'm doing quite a bit more logic in these methods, like so: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=63cf028d8e760b51fd049b44]
<FromGitter> <lstrzebinczyk> this is from the actual code I'm working on
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=63cf02c97740c84e492cf673]
<FromGitter> <lstrzebinczyk> interesting!
<FromGitter> <Blacksmoke16> basically same as if you manually added: ⏎ ⏎ ```def inner(value : String) ⏎ object = Inner.new value: value ⏎ pp object ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=63cf02e880dc214e328a167e]
<FromGitter> <lstrzebinczyk> I am going to save that, and potentially make a use of it
<FromGitter> <lstrzebinczyk> thank you : )
<FromGitter> <Blacksmoke16> tho really if depending on how many methods/parameters there are, id prob just hard code it all and not use the macro
<FromGitter> <lstrzebinczyk> Do you think more native support for this kind of operation could come into the language?
quazimodo has joined #crystal-lang
<FromGitter> <lstrzebinczyk> something like `def inner(**args : Arguments(Inner[:initialize]))`, syntax for which I've just came up with on the spot
<FromGitter> <Blacksmoke16> i dont think it ever really came up before
<FromGitter> <Blacksmoke16> feels a bit niche tho
<FromGitter> <lstrzebinczyk> let me tell you more about what I'm doing and where it came from
<FromGitter> <lstrzebinczyk> I am working on a hobby project and doing a small desktop app, based on https://oprypin.github.io/crsfml/
<FromGitter> <lstrzebinczyk> and CrSFML pretty much only provides rectangles and text, so I'm coming up with a framework to declaratively define the ui
<FromGitter> <lstrzebinczyk> and I'm having UIs that look like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=63cf041e49431d637012fd89]
<FromGitter> <lstrzebinczyk> this particular one is in the middle of being reorganized, so it's a bit chaotic, but that's exactly the issue
<FromGitter> <lstrzebinczyk> since I'm actively working on these components, it changes that my `UI::Button` or `UI::Horizontal` accepts as params
<FromGitter> <lstrzebinczyk> and now if I change initializer of `UI::Button`, I have about a dozen of places where the `button(...)` is called, but compiler only shows me the issue in the initializer of `UI::Button`
<FromGitter> <lstrzebinczyk> so I pretty much need to grep my codebase for where it's used
<FromGitter> <lstrzebinczyk> I don't want to be a broken record, but I think typescript spoiled me, since it has exactly the solution to this 😅
<FromGitter> <lstrzebinczyk> btw, I absolutely love Crystal!
<FromGitter> <Blacksmoke16> could also possibly be something https://github.com/crystal-lang/crystal/issues/8410 could improve
<FromGitter> <lstrzebinczyk> this is coming from the place of love and adoration
<FromGitter> <Blacksmoke16> like if you run with `--error-trace` you can see like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ which tells you which `inner` call is erroneous [https://gitter.im/crystal-lang/crystal?at=63cf050c7740c84e492cfb46]
<FromGitter> <lstrzebinczyk> interesting, I wasn't aware of that option!
taupiqueur1 has joined #crystal-lang
<FromGitter> <lstrzebinczyk> Actually, since I'm already in a good place... I'm actually trying to write blog posts about exactly the app I'm working on at https://lstrzebinczyk.github.io/the_empire_blog/. The posts didn't quite get to the issue I'm describing, but they will get there in 1 or 2 posts
<FromGitter> <Blacksmoke16> 👍
taupiqueur has quit [Ping timeout: 256 seconds]
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
Sankalp- has joined #crystal-lang
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- is now known as Sankalp
Vexatos_ is now known as Vexatos
<FromGitter> <z:uxn.one> Got a big switch to play with, actually two of them