non-aristotelian has quit [Quit: non-aristotelian]
blove has quit [Quit: WeeChat 2.3]
<FromGitter>
<pitosalas> Question? About property and initialization...
<FromGitter>
<pitosalas> Can someone clarify: if I define a property with a datatype. e.g. property name : String, do I still have to initialize it in the initializer? Is there a way to do all at the same time? define getters, setters, declare a type, and initialize?
notdaniel has quit [Read error: Connection reset by peer]
sz0 has quit [Quit: Connection closed for inactivity]
oz has quit [Ping timeout: 240 seconds]
oz has joined #crystal-lang
pabs has left #crystal-lang [#crystal-lang]
pabs has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Remote host closed the connection]
<FromGitter>
<dscottboggs_gitlab> you can do `property row_headers = [] of String`
<FromGitter>
<j8r> No @dscottboggs_gitlab the first syntax is better, because the standard way to instantiate objects
<FromGitter>
<dscottboggs_gitlab> that may be your opinion but both forms are valid. I was just pointing it out because it was closer to what @pitosalas was trying to do. I do think the empty array syntax is confusing though.
<FromGitter>
<j8r> This `of` syntax hurts because with it some beginners struggle to do Array of Array. Unnecessary complexity built a top of Array(T).new
<FromGitter>
<dscottboggs_gitlab> the problem with it for me was when I first started was that I tried to declare types as empty arrays.
<FromGitter>
<dscottboggs_gitlab> `[] of [] of T` doesn't work?
<FromGitter>
<dscottboggs_gitlab> nope, it doesn't. yeah that really seems like unnecessary sugar
<FromGitter>
<bararchy> yeha the `of` is really bad, I loved it at first but it makes the code less readable
<FromGitter>
<bew> It depends on your code
<FromGitter>
<bararchy> `Array of String` ⏎ `Array(String).new`
<FromGitter>
<bararchy> I think the type inside the () make it look clearer
<FromGitter>
<bew> I mean, it's faster for your brain to parse `[] of ..` / `{} of .. => ..` than the standard `Array(..).new`
<FromGitter>
<bew> when reading code, it's nice to be able to immediately spot containers
<FromGitter>
<proyb6> Crystal is not yet supported?
<FromGitter>
<bararchy> @proyb6 not supported where?
<FromGitter>
<j8r> But @bew this is non standard. Now I'm used to use `.new` every time to instantiate objects. Ok the `[]` and `{}` might be better looking, but only useful for Array and Hash - one more thing to learn, than can be avoided. Also this adds useless complexity to the compiler
<FromGitter>
<j8r> this also hides the very type behind: for me `[]`, brackets, can mean `Array` or `StaticArray` or `Set`. `{}` can mean `Hash` or `NamedTuple` or `Tuple`
<FromGitter>
<proyb6> @bararchy Click here to see the list of supported languages.
<FromGitter>
<j8r> Maybe @asterite or @RX14 have an explication why this syntax exists
<FromGitter>
<proyb6> there is a button listing all the supported languages
<RX14>
I'm the wrong person to ask, I proposed removing them lol
<FromGitter>
<bararchy> @proyb6 so... click this random link (that you didn't post) to see what you mean? can't you just tell me "isn't supported in ... somewhere"
<RX14>
But we still need [] and {}
<RX14>
Well we still need array and harsh literals
<RX14>
So disallowing empty ones was seen as a bit weird
<FromGitter>
<bararchy> literals make sense
<RX14>
They're not that bad
rohitpaulk has joined #crystal-lang
<FromGitter>
<j8r> yes,`{ "a" => 1 }`, `{ "a", "b"}` and `{ a: "b"}` are clear
<FromGitter>
<j8r> But we have `{} of String, String` (a Hash or a NamedTuple)? `{} of String` is invalid too
<FromGitter>
<j8r> BTW empty Tuple, NamedTuple or StaticArray have little sense
ashirase has quit [Ping timeout: 268 seconds]
rohitpaulk has quit [Ping timeout: 268 seconds]
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<straight-shoota> @j8r empty literals can happen when they're constructed by macros.
<FromGitter>
<proyb6> @bararchy Sorr, I'm on my lhk e
<FromGitter>
<proyb6> phone all the while, there is a button on the website which shown the supported language
<FromGitter>
<proyb6> I been using Vin for all editing and coding but it's a little tedious, only if you can develop CLI to generate code faster like Laravel does?
<FromGitter>
<bew> what kind of generation do you need?
<FromGitter>
<proyb6> @bew Previously I have used Perfect web framework could be easier with HI wizard
<FromGitter>
<bew> I mean if you need it for some web frameworklike amber or lucky they already have tools like that to generate basic files
<FromGitter>
<neutrinog> hey I've been tinkering with developing a 3d game engine in crystal. I've seen several attempts, but most are stale and not very far along. I'm building this 3D engine so I have an excuse to learn crystal (love it!). Anyway I thought I'd share a demo of what I've done so far. Maybe generate some interest. https://www.youtube.com/watch?v=-IyXs2Dqs2o&feature=youtu.be
<FromGitter>
<bew> That's pretty cool, does it use opengl? (also, on the video the screen flickers, you know why?)
<FromGitter>
<neutrinog> it currently uses opengl but down the road I'd like too support vulcan as well. The flickering is due to my screen recorder :(
<FromGitter>
<f1refly_gitlab> @neutrinog That looks awesome
<FromGitter>
<Blacksmoke16> would print the request obj before making the request @7sedam7
<FromGitter>
<7sedam7> do you know by heart how to do the same printout with curl so i can compare?
<FromGitter>
<7sedam7> thanks for the help @Blacksmoke16
<FromGitter>
<Blacksmoke16> uh try like `curl -v google.com`
<FromGitter>
<7sedam7> thanks 🙇 Accept and User-Agent are different, will try if it makes any differenece
<FromGitter>
<7sedam7> Content-Length is a bit bigger with curl, but I don't see any difference besides that any more, still curl returns 200 and a json response and crystal 301 :/
<FromGitter>
<bararchy> @7sedam7 make sure URL is same to last letter as in curl end in `/` so same
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> I see your upper example is `/#{API_VERSION}/preorders` while in curl `/preorders/`
<FromGitter>
<pitosalas> @bararchy @j8r @bew Thanks... helpful... I thought I saw somewhere that [] of String is preferred to Array(String).new
<FromGitter>
<j8r> I really doubt @pitosalas . The syntax is referenced in the docs, that's it
<FromGitter>
<bew> There are 2 syntaxes, use whatever you want :)
<FromGitter>
<pitosalas> ok. I will see where I saw it . it might have. been a random stackoverflow response :)
<FromGitter>
<neutrinog> @bararchy github only shows `C 75.7%` because I'm importing `stb_image.h` until I can find a decent crystal image library. I'm only using one function out of that library to read in images.
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<alex-lairan> Hi everyone, ⏎ ⏎ I am using AmberFramework, and I want to Gzip for a specific pipeline (different than Amber::Pipe::Static) ⏎ ⏎ I want to get the HTTP::Server::Response body then update it. ... [https://gitter.im/crystal-lang/crystal?at=5bf597dff048fa1051ff3206]
<FromGitter>
<j8r> Some ideas are interesting, like compiling packages, create headers and then linking them to our main app
<FromGitter>
<j8r> The shards dependencies won't have to be recompiled each time.
<FromGitter>
<j8r> Crystal headers don't exist :(
<FromGitter>
<asterite> @j8r `[] of ...` exists because `[]` exists in Ruby, that's the equivalent in Crystal. Crystal is basically "let's make Ruby compiled". Most of the design decisions are based on that. It's probably too late now, but I would change a lot of things in the language
<FromGitter>
<r00ster91> which things? Besides `[] of ...`
<oprypin>
whenever you think something is wrong about the language, changes are it's one of those things
<oprypin>
chances*
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
<FromGitter>
<j8r> Doing radical breaking changes is a major point in a language. Python with 2 -> 3. The append-only C++. Perl 5 and 6.
<FromGitter>
<j8r> If Crystal can deprecate things properly, and make radical changes, it will stay attractive durably
<FromGitter>
<r00ster91> Yeah Crystal is still in a very early stage and thus I wouldn't say it's too late to change things. I don't see any problem with breaking (language) changes before 1.0.0.
rohitpaulk has joined #crystal-lang
Jenz has joined #crystal-lang
* Jenz
o/
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
<jokke>
o/
<z64>
o/
<jokke>
does someone know where the default ca certs come from in openssl? i mean from the os for sure, but what if i statically link openssl?
<jokke>
currently a statically linked crystal binary fails with PubRelay::WebServer OpenSSL::SSL::Error: SSL_connect: error:14007086:SSL routines:CONNECT_CR_CERT:certificate verify failed
rohitpaulk has quit [Ping timeout: 240 seconds]
<jokke>
the binary runs in a scratch docker imag
<jokke>
e
<FromGitter>
<7sedam7> @bararchy urls are the same, i just removed the content for the example, but `/` was missing, and the API returns 301 if `/` is missing (and it does not behave like that for all the endpoints :D) ⏎ Thanks for the help 🙇
<jokke>
never mind
<jokke>
openssl version -d
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> @7sedam7 NP, happy I helped, I play around with HTTP a lot and this is quite a common scenario
rohitpaulk has quit [Ping timeout: 252 seconds]
<Jenz>
I love the automatic symbol to enum cast
Jenz has quit [Quit: Good day]
korzybski has quit [Quit: korzybski]
korzybski has joined #crystal-lang
ua has joined #crystal-lang
sz0 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
<FromGitter>
<Blacksmoke16> how would you edit the response and an http response
<FromGitter>
<Blacksmoke16> `undefined method 'body=' for HTTP::Server::Response`?
<FromGitter>
<Blacksmoke16> well i guess its write only so welp
<woodruffw>
what are you trying to accomplish? a `HTTP::Server::Response` is a chunk of data returned by a server, so it makes sense for it not to be modifiable
<woodruffw>
(you can probably `dup` the actual body and then modify that copy)
<FromGitter>
<Blacksmoke16> (using kemal) plan was to have an `after` filter that runs after certain routes that handles serialization depending on the context, like which route it is etc
<FromGitter>
<Blacksmoke16> mainly just messing around
<woodruffw>
ah, i see. yeah, for that it might make sense to duplicate the whole response
<woodruffw>
(but i'm not extremely familiar with kemal, so there might be a less memory intensive way)