jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
HumanGeek has quit [Quit: Leaving]
alexherbo2 has quit [Remote host closed the connection]
<FromGitter> <asterite> An Int can be passed to any type parameter of a generic class. But it's only used in the std in static array. So maybe it's not a special case, just a special need
<FromGitter> <dscottboggs> can't *any* constant be used as a generic argument?
<FromGitter> <Blacksmoke16> generics can only be Integers and types afaik
<FromGitter> <dscottboggs> kinda lame IMO
zorp has quit [Ping timeout: 265 seconds]
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
DamionDreggs has joined #crystal-lang
DamionDreggs has quit [Quit: I Quit!]
alexherbo2 has joined #crystal-lang
Xeago_ has joined #crystal-lang
Xeago has quit [Read error: Connection reset by peer]
Xeago_ is now known as Xeago
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
<FromGitter> <mixflame> good news guys
<FromGitter> <mixflame> I'm going live on the app store tomorrow (crystal backend)!
alexherbo23 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo23 is now known as alexherbo2
<FromGitter> <naqvis> awsome and congrats 👍
<FromGitter> <grkek> > I'm going live on the app store tomorrow (crystal backend)! ⏎ ⏎ Awesome!
postmodern has quit [Quit: Leaving]
<FromGitter> <mixflame> thanks guys
<FromGitter> <mixflame> :)
<FromGitter> <grkek> What did you use for a framework?
<FromGitter> <mixflame> raw swift
<FromGitter> <mixflame> it's an OS X app made in Swift
<FromGitter> <grkek> For the backend
<FromGitter> <mixflame> there's also my snap package which allows you to run the server
<FromGitter> <mixflame> I didn't use a framework for the backend. I used Crystal TCPServer class
<FromGitter> <grkek> So it is not based on HTTP its just TCP packets?
<FromGitter> <mixflame> yeah it's not based in HTTP, just TCP
<FromGitter> <mixflame> it does have a serverless backend used for a few things which uses http
<FromGitter> <grkek> Is it open source?
<FromGitter> <mixflame> it used to be, but to protect the users I made it private
<FromGitter> <mixflame> apple was big on making me protect the users
<FromGitter> <j8r> ... a bit scary to say that
<FromGitter> <mixflame> yeah it is
<FromGitter> <mixflame> but for a chat app you can understand, that if they reverse my server I can no longer enforce my obligations on the app store
<FromGitter> <mixflame> for example, I'm responsible to remove objectionable content from it in 24 hours
<FromGitter> <mixflame> *and* eject the user from servers I don't even control
<FromGitter> <j8r> I mean, if the code requires to be private to be secure, i.e. there are sensitive info inside it, that's bad :/
<FromGitter> <mixflame> no there's no sensitive info
<FromGitter> <mixflame> i just want to keep them from nulling out my global admin abilities
<FromGitter> <mixflame> it contains strong encryption
<FromGitter> <mixflame> if users can't report or get banned from a server or anything, and it remains publically visible in my app somehow, and they are posting illegal content, my app is dunzo
<FromGitter> <grkek> And how can that encryption can be bypassed by seeing sourcecode?
<FromGitter> <grkek> if you have the key
<FromGitter> <mixflame> it can't, it doesn't use symmetric encryption
<FromGitter> <mixflame> it uses public key encryption
<FromGitter> <mixflame> e2e and encrypted chat
<FromGitter> <mixflame> I cannot see server messages unless reported
<FromGitter> <grkek> And how does it being open source endanger users?
<FromGitter> <mixflame> someone could easily make an 'evil' client or server which I wouldn't be able to protect users on
<FromGitter> <mixflame> due to the distributed nature of it
<FromGitter> <j8r> this should be made impossible by design
<FromGitter> <j8r> because one can reverse-engineer the App store client
<FromGitter> <mixflame> true
<FromGitter> <j8r> or through Wireshark
<FromGitter> <j8r> then forge packets
<FromGitter> <mixflame> not a bad idea to make it impossible by design
<FromGitter> <mixflame> right now all you need to do is NOP when a server refreshes and no one will ever get banned lol
<FromGitter> <grkek> So what you are telling me is that you have a centralized server which gets report requests and then you are able to see the messages?
<FromGitter> <mixflame> yes
<FromGitter> <grkek> Why use the reporting system anyway?
<FromGitter> <mixflame> so I know if its worth banning the user
<FromGitter> <mixflame> it's for users who are being targetted for cyberbullying, harassment or trolling
<FromGitter> <grkek> Give them a block ability
<FromGitter> <mixflame> cyberstalkers, etc etc
<FromGitter> <j8r> what's the app, a forum?
<FromGitter> <grkek> and make the chat stateless
<FromGitter> <mixflame> they do have it
<FromGitter> <mixflame> apple demanded report AND block
<FromGitter> <mixflame> here I have a video of the app
<FromGitter> <grkek> oh nice
<FromGitter> <grkek> let us see
<FromGitter> <mixflame> two videos actually
gangstacat has quit [Ping timeout: 272 seconds]
<FromGitter> <j8r> Now I'm more and more in favor of bypassing this Apple App store for "simple apps": Using PWA, with the "Add to Desktop" option in mobiles
<FromGitter> <j8r> Plus, cross-platform "for free"
<FromGitter> <mixflame> same here but I needed the free sales and globalness of it
<FromGitter> <mixflame> I'm not good at selling the software myself
<FromGitter> <j8r> free sales?
<FromGitter> <mixflame> not free sales
<FromGitter> <grkek> The UI clearly needs some work
<FromGitter> <grkek> but it looks rlly nice so fat
<FromGitter> <mixflame> thanks
<FromGitter> <mixflame> by free sales I mean sales you wouldn't get without the centralization of the app store
<FromGitter> <mixflame> still, I think the android app store is easier for developers
<FromGitter> <j8r> maybe... but there are billions of apps, so...
<FromGitter> <mixflame> we have an android/ios crossplatform dart app coming which will also use the same crystal backend
<FromGitter> <mixflame> yeah
<FromGitter> <mixflame> imo it just needs to be a good enough app that people tell eachother to get it and have fun with it
<FromGitter> <j8r> a web site is maybe less visible, but easier to try out.
<FromGitter> <mixflame> yeah, this grew out of a website
<FromGitter> <mixflame> it was originally a rails site that allowed anyone to come and draw on it and would save the picture to redis
<FromGitter> <j8r> how the client is made?
<FromGitter> <grkek> Instead of swift
<FromGitter> <grkek> you could've tried
<FromGitter> <mixflame> Swift
<FromGitter> <grkek> electron
<FromGitter> <mixflame> true but I don't think electron could go on the app store, I've used it
<FromGitter> <mixflame> also the web version had canvas bugs that dont exist in native
<FromGitter> <mixflame> because of javascript issues
<FromGitter> <mixflame> that i neve could solve
<FromGitter> <j8r> there is Apache Cordova, that's the mobile Electron
<FromGitter> <mixflame> i went native and avoided web because of bugs and speed issues
alexherbo2 has quit [Ping timeout: 256 seconds]
<FromGitter> <mixflame> this is my 4th collaborative drawing app
<FromGitter> <mixflame> i tried web, blockchains, c++
gangstacat has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<FromGitter> <mixflame> swift isn't my favorite language still but its still easier than C++
<FromGitter> <j8r> not convinced about the native advantages for a forum/chat...
<FromGitter> <mixflame> it's the drawing component that needs native
<FromGitter> <mixflame> did you see the collaborative canvas in the video?
<FromGitter> <j8r> ha noice!
<FromGitter> <mixflame> native speed lets load/render faster and gets rid of bugs i experienced when I wrote this (open source 4 u)https://github.com/mixflame/gbalda
<FromGitter> <mixflame> thanks
<FromGitter> <mixflame> i perfected the rendering algorithm in the web version but it had weird bugs that werent my fault
<FromGitter> <mixflame> i filed a firefox bug about them, not sure if they ever solved it but my code stands
<FromGitter> <grkek> You can write native with C API integrations of Node
<FromGitter> <grkek> C/C++
<FromGitter> <mixflame> it's not node thats the issue
<FromGitter> <mixflame> it's frontend web that cant handle it
<FromGitter> <grkek> WebAssembly?
<FromGitter> <j8r> RIP https://github.com/JohnMcLear/draw
<FromGitter> <mixflame> I thinkt here was a bug in the <canvas> tag
<FromGitter> <mixflame> i never solved it
<FromGitter> <grkek> Thats via websockets isnt it? @mixflame
<FromGitter> <grkek> @j8r *
<FromGitter> <grkek> sorry mistagged
<FromGitter> <mixflame> users could draw as usual together, but sometimes there would be random straight lines in the canvas
<FromGitter> <mixflame> because javascript didnt segregate my data or something at the speeds users were drawing in single thread. not sure
<FromGitter> <mixflame> however, the bug doesnt exist in my app store app and it uses the same algorithms
<FromGitter> <grkek> Welp that electron uses chromium
<FromGitter> <grkek> so no friefox there
<FromGitter> <grkek> and the canvas error wouldnt be present anyways/ ⏎ ?
<FromGitter> <j8r> @grkek I guess for WS
<FromGitter> <mixflame> the bug was present in chromium as well
<FromGitter> <mixflame> it might have been a bug in my code but I coud never find it
<FromGitter> <mixflame> multi user access to a canvas in javascript is a big old hack
<FromGitter> <grkek> Can't you write custom canvas objects in webassembly?
<FromGitter> <mixflame> I've never used web assembly but maybe
<FromGitter> <grkek> WebAssembly + WebSockets + ElectronJS
<FromGitter> <grkek> and you would have a horrific app
<FromGitter> <grkek> :D
<FromGitter> <grkek> damn I hate JS
zorp has joined #crystal-lang
<FromGitter> <mixflame> Lol
<FromGitter> <mixflame> just use vscode and typescript and you'll be fine
<FromGitter> <mixflame> remember, my app does contain some javascript in the master server list backend (serverless functions with node)
<FromGitter> <mixflame> I happily used typescript to aid the development
<FromGitter> <mixflame> I'm a full on supporter of websockets though but some people disable it
<FromGitter> <grkek> WebSockets are one of my favorite technologies
<FromGitter> <mixflame> yeah. webassembly seems real cool too but I just haven't used it yet
<FromGitter> <mixflame> i truely wanna see native speed apps in the browser
<FromGitter> <mixflame> though JIT is always slower than AOT
<FromGitter> <mixflame> guess what
<FromGitter> <mixflame> you can compile swift to webassembly :D
<FromGitter> <grkek> You make music as well ;)?
<FromGitter> <mixflame> yeah well I haven't in a bout 6 months but I have a lot of old material
<FromGitter> <mixflame> i got caught up with programming, I had a job but I got laid off, but I was working full time coding
<FromGitter> <grkek> I followed you on soundcloud ;)
<FromGitter> <mixflame> thanks :D
<FromGitter> <mixflame> DragonShadow303?
<FromGitter> <grkek> I make music as well
<FromGitter> <grkek> yup
<FromGitter> <mixflame> awesome
<FromGitter> <mixflame> electronic music?
<FromGitter> <grkek> Idk all kinds of music
<FromGitter> <mixflame> if I get real inspired I will fire up fl studio or ableton and try to make a piece
<FromGitter> <mixflame> nice
<FromGitter> <grkek> You use both as well?
<FromGitter> <grkek> Nice
<FromGitter> <j8r> like ballet music?
<FromGitter> <mixflame> usually prefer FL Studio but i can have fun in ableton
<FromGitter> <grkek> I might as well be able to make ballet music
<FromGitter> <grkek> FL studio is faster to prototype but the quality is shite
<FromGitter> <j8r> haha :)
<FromGitter> <mixflame> I'm told I play in key but I've been so soaking in the code
<FromGitter> <grkek> music took away 3 years of my life :D
<FromGitter> <mixflame> maybe I'll make some now that you mention it. everyone that knows I play wants me to
<FromGitter> <grkek> I was just doing music nothing else
<FromGitter> <mixflame> lol me too brother me too
<FromGitter> <mixflame> I gotta play more, I don't wanna lose it
<FromGitter> <grkek> I used to make dubstep when It was cool way back in the times
<FromGitter> <grkek> "cool"
<FromGitter> <mixflame> I've tried to make dubstep a few times, lol but I'm not the best at it
<FromGitter> <j8r> what about Ardour?
<FromGitter> <mixflame> Ardour would be great I think if you had a lot of samples already
<FromGitter> <mixflame> never used it tho
<FromGitter> <mixflame> i have used LMMS and like it
<FromGitter> <grkek> Ableton > everything
<FromGitter> <grkek> Able ton
<FromGitter> <grkek> :p
<FromGitter> <mixflame> yeah ableton is great, I have a few jams on there with it
<FromGitter> <mixflame> session record is my favorite feature
<FromGitter> <j8r> LMMS looks also good. https://alternativeto.net/software/lmms/
<FromGitter> <j8r> one of the most popular
<FromGitter> <mixflame> lmms just keeps getting better and better
<FromGitter> <mixflame> people really want a free fl studio
<FromGitter> <grkek> the ui looks so bad tho
<FromGitter> <mixflame> lol yeah true
<FromGitter> <j8r> "I prefer Audacity" lol, not the same purpose
<FromGitter> <mixflame> lol
<FromGitter> <mixflame> watch out for audacity trolls
<FromGitter> <mixflame> it's simply an audio editor with no musical capability
<FromGitter> <grkek> I actually made music with
<FromGitter> <grkek> audacity
<FromGitter> <grkek> :p
<FromGitter> <mixflame> lol nice
<FromGitter> <grkek> Used shit loads of effects on top of the audio
<FromGitter> <j8r> that's like vi and Eclipse
<FromGitter> <mixflame> lmao I know
<FromGitter> <mixflame> notepad vs vscode
<FromGitter> <j8r> can vscode be considered as an IDE?
<FromGitter> <grkek> No
<FromGitter> <mixflame> i consider it as a lightweight one
<FromGitter> <grkek> It is a text editor with plugins
<FromGitter> <mixflame> i prefer it to IDEs tho
<FromGitter> <grkek> same
<FromGitter> <grkek> clunky heavy memory eating ide's
<FromGitter> <mixflame> yeah clunky
<FromGitter> <mixflame> with bad plugins and bad code formatting and stuff lol
<FromGitter> <mixflame> bad color schemes
<FromGitter> <grkek> 1) that you can straight up go unpack asar files and edit whatever the fuck you want in vs code source
<FromGitter> <grkek> (+ that)
<FromGitter> <mixflame> true
<FromGitter> <mixflame> i love vs code liveshare btw
<FromGitter> <mixflame> tons of fun
<FromGitter> <grkek> Sounds fun :)
<FromGitter> <mixflame> yeah try it sometime with a friend who codes!!!
<FromGitter> <mixflame> you can watch eachother and then when one gets stuck, bam the other one starts typing code and finishing it
<FromGitter> <grkek> i have no friends
<FromGitter> <j8r> I like to say: ⏎ "Geany is an IDE that acts as an Editor" ⏎ "VSCode/Atom is an Editor that acts as an IDE"
<FromGitter> <grkek> who code
<FromGitter> <grkek> I used to have a gf
<FromGitter> <grkek> but she left me rip
<FromGitter> <grkek> who coded*
<FromGitter> <mixflame> epic
<FromGitter> <mixflame> well
<FromGitter> <mixflame> when you do find someone maybe online or something its a great way to code together
<FromGitter> <grkek> :DDDDD
<FromGitter> <grkek> aight man
<FromGitter> <grkek> have a great day
<FromGitter> <grkek> gtg now
<FromGitter> <mixflame> cya
<FromGitter> <mixflame> yo too
<FromGitter> <j8r> "A girl who coded left me, now have to code a girl friend to join me"
<FromGitter> <mixflame> lmao
<FromGitter> <mixflame> sardonic
<FromGitter> <j8r> would be great if that was possible
<FromGitter> <j8r> in a way, we are starting to do so by manipulating DNA. We could make people with traits we want
<FromGitter> <j8r> like GMOs
<FromGitter> <mixflame> I wouldn't mind it either
<FromGitter> <j8r> please someone tell them to use Crystal :P
<FromGitter> <mixflame> I think we should just grow to Crystal scene as much as possible so there are more Crystal coder girlfriends in existence
<FromGitter> <j8r> Yeah great idea!
<FromGitter> <mixflame> :D
<FromGitter> <mixflame> im eyeing this lol https://swiftwasm.org/
<FromGitter> <mixflame> im not inspired to use it, just cool to know bout
<FromGitter> <mixflame> let me know when every major IDE compiles native stuff to WASM easily and then deploys it for you
<FromGitter> <j8r> what's the big deal of wasm, except performance sensitive stuff like games?
<FromGitter> <mixflame> my drawing thing *is* performance sensitive
<FromGitter> <mixflame> imagine 20 people drawing
<FromGitter> <j8r> ...not very sure
<FromGitter> <mixflame> it's happened on my site t
<FromGitter> <j8r> network would be the bottleneck sooner than client perf
<FromGitter> <mixflame> it's single threaded so the more people drawing the slower it gets
<FromGitter> <j8r> like Videoconferencing
<FromGitter> <mixflame> hmmm
<FromGitter> <mixflame> maybe javascript in the browser is just slow
<FromGitter> <j8r> is it designed centrally, or decentrally?
<FromGitter> <mixflame> the new app is decentralized
<FromGitter> <mixflame> the old one was centralized
<FromGitter> <mixflame> i did it to allow people to have their very own canvases
<FromGitter> <j8r> that makes sense if each client has to render other client draws, this becomes more and more expensive
<FromGitter> <mixflame> admin has certain abilities (regular admin) like clearing the canvas, deleting a user's layers and anonymous IP banning people
<FromGitter> <mixflame> yeah
<FromGitter> <mixflame> it does
<FromGitter> <j8r> Why that's not the server doing this, then sending back to all?
<FromGitter> <mixflame> it's based on the design of classical drawing example code
<FromGitter> <mixflame> saving points
<FromGitter> <mixflame> the server could draw it, but then it'd have to send maybe delta encoded bitmap back or something
<FromGitter> <mixflame> also.. it's very easy to draw on the client.
<FromGitter> <grkek> How to check if a type is either of the union types?
<FromGitter> <j8r> in you mean?
<FromGitter> <j8r> nvm, my bad
<FromGitter> <j8r> yes you can, with a macro
<FromGitter> <grkek> Meh I used .as()
<FromGitter> <grkek> works just as fine
Stephie has quit [Quit: Fuck this shit, I'm out!]
Vexatos has quit [Quit: ZNC Quit]
Stephie has joined #crystal-lang
Vexatos has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <grkek> What do you guys think of function chaining like this?
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f43ad8d48237809373ccd6c]
<yxhuvud> interesting. No other opinions. Why do you have explicit halts?
<FromGitter> <grkek> Kemal has one ?
<FromGitter> <grkek> I guess thats why
<FromGitter> <grkek> It just closes the port
<FromGitter> <grkek> io port
<FromGitter> <grkek> of the response
<FromGitter> <Blacksmoke16> are you required to call `.halt`?
<FromGitter> <Blacksmoke16> because that would make it impossible to run like after controller stuff since headers couldnt be written
<FromGitter> <alehander92> and also what happens if you forget halt
<FromGitter> <grkek> No you are not required to halt
<FromGitter> <grkek> Nothing happens if you dont add halt
<FromGitter> <grkek> it just writes the json contet
<FromGitter> <grkek> and returns the resonse
<FromGitter> <grkek> response
<FromGitter> <grkek> halt just cuts the response instantly
<FromGitter> <grkek> it just closes the
<FromGitter> <grkek> context.response
<FromGitter> <grkek> json
<FromGitter> <grkek> does two things
<FromGitter> <grkek> writes content type
<FromGitter> <grkek> and content
<FromGitter> <grkek> the response is still closed afterwards for json response, the halt just acts as a insta closer for it
<FromGitter> <j8r> I hope this is not the stdlib's `Context`...
<FromGitter> <grkek> it is stdlib context
<FromGitter> <grkek> is it bad to close it like that?
<FromGitter> <Blacksmoke16> more so all the reopening
<FromGitter> <j8r> boo bad, monkey patching should be the last solution
<FromGitter> <grkek> Well the std libs response has ensure headers written extension from kemal I think
<FromGitter> <grkek> > monkey patching should be the last solution
<FromGitter> <grkek> why tho?
<FromGitter> <grkek> what does this ruin?
<FromGitter> <grkek> I already had monkey patching done in the context before
<FromGitter> <grkek> so does kemal
<FromGitter> <j8r> because, a library you require change the API, and can possibly even how it works.
<FromGitter> <grkek> and many other frameworks
<FromGitter> <j8r> not really, only if there is no choice
<FromGitter> <j8r> monkey patching others objects means harder for the user to use it
<FromGitter> <grkek> imo monkey patching seems fine to me, it doesn't matter if I add the functions to the stdlib context or my own context still would do the same
<FromGitter> <grkek> as long as there is an evidence of others using monkey patching it is fine to me as well
<FromGitter> <grkek> as fast as someone adds something to monkey patch I implement it as well
<FromGitter> <j8r> this should not be the default, it is harder for the user to use the object
<FromGitter> <grkek> how is it harder for the user to use the object when I literally provide helper functions to use it easier ?
<FromGitter> <j8r> the given monkey-patched methods won't appear in https://crystal-lang.org/api/master/index.html
<FromGitter> <grkek> When you are using a framework you are supposed to learn things
<FromGitter> <j8r> If I see an error related to `HTTP::Server::Context#some_method, missing argument`. Then, naturally, one will look at the stdlib's doc
<FromGitter> <grkek> Not really
<FromGitter> <grkek> you would first look up for the framework
<FromGitter> <grkek> and then go to the stdlib
<FromGitter> <j8r> yes maybe. ⏎ And if you use another framework, or none at all? It is harder to know which methods was in the stdlib, and others added by the framework :/
<FromGitter> <grkek> You have documentation which provides that
<FromGitter> <grkek> Context doesn't really have any methods if you take a close look at it
<FromGitter> <grkek> it only has @request, @response thats it
<FromGitter> <Blacksmoke16> could use the builder pattern, then limit the added method to just like one
<FromGitter> <Blacksmoke16> ```context ⏎ .response_builder ⏎ .status(200) ⏎ .json({"id" => 1}) ⏎ .build``` [https://gitter.im/crystal-lang/crystal?at=5f43bcf95580fa092b1de7ab]
<FromGitter> <j8r> yep, better limiting monkey patches. ⏎ Also, you could have your own context
<FromGitter> <j8r> which holds the stdlib's one ⏎ That's how I've done with Gripen
<FromGitter> <j8r> ...hum in fact I have done 2 objects, anyway that's an option
alexherbo2 has joined #crystal-lang
<FromGitter> <grkek> 1) I don't see how these can lead to upgrade problems ⏎ 2) I will document these methods and make sure to use them ⏎ 3) I might consider response_builder but that is quite unlikely
<FromGitter> <grkek> The pitfalls most of them depend on the end user and if the end user uses a malicious shard its their own fault since the API still can be monkey patched by the shard so this makes no sense what so ever in the crystal world
<FromGitter> <grkek> My own context sounds like a bottleneck and I wont be doing that at all
<FromGitter> <alehander92> it's very opinionated
<FromGitter> <alehander92> but rails was also very opinionated
<FromGitter> <alehander92> i am not a crystal guy, so i should stop commenting tho
<FromGitter> <alehander92> :D
<FromGitter> <grkek> My framework is far more easier than rails is
<FromGitter> <grkek> with better routing features
<FromGitter> <grkek> and with this function chaining it will be even better
<FromGitter> <Blacksmoke16> i assume it has defaults so you wouldnt need to have a `put_status(200)` in every action?
<FromGitter> <grkek> yep
<FromGitter> <grkek> it has defaults yes
<FromGitter> <grkek> so just context.json() is enough for a response
alexherbo2 has quit [Ping timeout: 258 seconds]
<FromGitter> <Blacksmoke16> its deff an interesting approach
<FromGitter> <grkek> it looks a lot like the functional one
<FromGitter> <j8r> other option: ⏎ ⏎ ```context[ ⏎ status: 200 ⏎ json: ({"id" => 1}) ⏎ ]``` [https://gitter.im/crystal-lang/crystal?at=5f43c34849148b41c96c5b3c]
<FromGitter> <j8r> (missed the comma)
<FromGitter> <grkek> noooooo
<FromGitter> <grkek> nooo no no
<FromGitter> <grkek> that looks horrible
<FromGitter> <Blacksmoke16> or you could abstract this stuff and just have the action return the data
<FromGitter> <grkek> abstract what?
<FromGitter> <Blacksmoke16> i dont have a concrete example, just not sure how i feel about how most frameworks work via passing in the context to the action
<FromGitter> <Blacksmoke16> like does the action actually need that/should be coupled with it?
<FromGitter> <Blacksmoke16> should it be concerned with what format its returning?
<FromGitter> <grkek> I mean not really
<FromGitter> <grkek> as long as it returns context
<FromGitter> <grkek> you can return text
<FromGitter> <grkek> html
<FromGitter> <grkek> binary
alexherbo2 has joined #crystal-lang
<FromGitter> <grkek> whatever you want
<FromGitter> <grkek> idk
<FromGitter> <Blacksmoke16> i guess what im getting at is should it be the responsibility of the controller action itself to determine how to render the response data in each format
<FromGitter> <Blacksmoke16> (this isn't specific to your framework, just a general architectural thought)
<FromGitter> <grkek> Ah okay
<FromGitter> <grkek> interesting yes
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
woodruffw has quit [Ping timeout: 240 seconds]
yxhuvud has quit [Ping timeout: 240 seconds]
sorcus has quit [Ping timeout: 240 seconds]
iwq has quit [*.net *.split]
duane has quit [*.net *.split]
deimos_ has quit [*.net *.split]
djuber has quit [*.net *.split]
MasterdonX has quit [*.net *.split]
DTZUZU has quit [*.net *.split]
baweaver has quit [*.net *.split]
olbat has quit [*.net *.split]
davic has quit [*.net *.split]
Vexatos has quit [*.net *.split]
zorp has quit [*.net *.split]
ua has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
r0bacarp has quit [*.net *.split]
gangstacat has quit [*.net *.split]
_whitelogger has joined #crystal-lang
<FromGitter> <Blacksmoke16> a new developer wouldnt be let lose on a new codebase without guidance
<FromGitter> <Blacksmoke16> from other devs, theres going to be a learning curve regardless of the framework
<FromGitter> <grkek> In my case I forget everything from the previous day
<FromGitter> <grkek> I have short term memory loss
<FromGitter> <grkek> and I don't remember most of the parts from previous day
<FromGitter> <grkek> :D
<FromGitter> <grkek> what will you do now?
<FromGitter> <Blacksmoke16> grep for the path/controller you want
<FromGitter> <grkek> I don't know how to use grep
<FromGitter> <Blacksmoke16> if you're using sublime its `CMD + shift + f`
<FromGitter> <Blacksmoke16> find in path
<FromGitter> <Blacksmoke16> idt its a big deal, this is more of an organizational problem of your project if you cant find what you need
<FromGitter> <grkek> I mean I know it but someone might not know
<FromGitter> <grkek> in any case
<FromGitter> <grkek> I think this way is better
<FromGitter> <grkek> instead of separating it into files
<FromGitter> <Blacksmoke16> until you add a new controller action, then go to use it and wonder why it doesnt work; because you forgot to add it in the other file 😉
<FromGitter> <Blacksmoke16> i dont think theres a right/wrong way, just diff approaches
<FromGitter> <Blacksmoke16> each with pros/cons
<FromGitter> <grkek> when u use resource for the macro it adds other actions automatically
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <grkek> so basically that point is gone
<FromGitter> <grkek> haha
<FromGitter> <grkek> B-)
<FromGitter> <mtsmmp_gitlab> guys
<FromGitter> <grkek> sup
<FromGitter> <mtsmmp_gitlab> how to declare an optional param on initialize and check if it exists
<FromGitter> <grkek> property number : Int32?
<FromGitter> <Blacksmoke16> with a default value if it doesnt?
<FromGitter> <grkek> and then check it in the init function?
<FromGitter> <Blacksmoke16> got an example of what you're trying to do @mtsmmp_gitlab ?
<FromGitter> <mtsmmp_gitlab> > with a default value if it doesnt? ⏎ ⏎ yes it can have a default value if it does not exist
<FromGitter> <mtsmmp_gitlab> but id like to know how to do it without the default value too
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9l21 ?
<FromGitter> <mtsmmp_gitlab> this is what i would like to be
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
<FromGitter> <mtsmmp_gitlab> def initialize(config) ⏎ if config ⏎ # do something ⏎ end ⏎ end [https://gitter.im/crystal-lang/crystal?at=5f43e2449bad075eacd3bc31]
<FromGitter> <mtsmmp_gitlab> grr
<FromGitter> <mtsmmp_gitlab> </code>def initialize(config) ⏎ if config ⏎ # do something ⏎ end ⏎ end<code> [https://gitter.im/crystal-lang/crystal?at=5f43e250765d633c54ad78b9]
<FromGitter> <grkek> understandable
<FromGitter> <grkek> You use backticks
<FromGitter> <Blacksmoke16> its three `
alexherbo2 has joined #crystal-lang
<FromGitter> <mtsmmp_gitlab> forgot =(
<FromGitter> <Blacksmoke16> the newline, code, newline, `
<FromGitter> <mtsmmp_gitlab> noob af
<FromGitter> <grkek> ```def initialize(config) ⏎ if config ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f43e275ec534f584fbb3ee9]
<FromGitter> <mtsmmp_gitlab> ```def initialize(config) ⏎ if config ⏎ # do something ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f43e27c89cf2d584b726f9a]
<FromGitter> <mtsmmp_gitlab> yes
<FromGitter> <Blacksmoke16> what is config tho? another object?
<FromGitter> <mtsmmp_gitlab> > https://play.crystal-lang.org/#/r/9l21 ? ⏎ ⏎ ill check
<FromGitter> <mtsmmp_gitlab> > what is config tho? another object? ⏎ ⏎ config is a class
<FromGitter> <mtsmmp_gitlab> config = Config.new
<FromGitter> <mtsmmp_gitlab> that would be the default value
<FromGitter> <grkek> basically that should work
<FromGitter> <grkek> since if it is nil it wont execute the if block
<FromGitter> <grkek> if not nil it will execute
<FromGitter> <Blacksmoke16> so yea, `def initialize(@config : Config = Config.new)`?
<FromGitter> <grkek> looks right
<FromGitter> <mtsmmp_gitlab> ok ill check that
<FromGitter> <mtsmmp_gitlab> i put config = Config.new on the param
<FromGitter> <mtsmmp_gitlab> i think its overwriting it
<FromGitter> <Blacksmoke16> can you make a more complete example of what you're tryin to do and/or the problem https://play.crystal-lang.org/#/cr
<FromGitter> <Blacksmoke16> would be much easier to help
<FromGitter> <mtsmmp_gitlab> sure buddy
<FromGitter> <mtsmmp_gitlab> let me test your info first
<FromGitter> <mtsmmp_gitlab> https://play.crystal-lang.org/#/r/9l27
<FromGitter> <mtsmmp_gitlab> > can you make a more complete example of what you're tryin to do and/or the problem https://play.crystal-lang.org/#/cr ⏎ ⏎ can you understand my example?
<FromGitter> <Blacksmoke16> why would you expect them to be different?
<FromGitter> <Blacksmoke16> they both use `Config.new`
<FromGitter> <Blacksmoke16> so they would be the same?
<FromGitter> <mtsmmp_gitlab> i changed the initalize to load a different file
<FromGitter> <mtsmmp_gitlab> even if i pass the config loaded with config2.yml
<FromGitter> <mtsmmp_gitlab> it overwrites with config.yml of initialize
<FromGitter> <mtsmmp_gitlab> at least thats what im getting
<FromGitter> <mtsmmp_gitlab> > i changed the initalize to load a different file ⏎ ⏎ the config initializer
<FromGitter> <Blacksmoke16> i.e. `File.read("config.yml")` changed to `File.read("config2.yml")` with no other changes?
<FromGitter> <mtsmmp_gitlab> yes
<FromGitter> <Blacksmoke16> why would you expect that to work?
<FromGitter> <mtsmmp_gitlab> bcuz config2.yml has different data
<FromGitter> <mtsmmp_gitlab> it didnt prioritize
<FromGitter> <Blacksmoke16> how would it know about the first config if you told it to always read the 2nd one?
<FromGitter> <Blacksmoke16> they're going to be the same since its hard coded in the initializer of the config class
<FromGitter> <Blacksmoke16> you would need to do something like https://play.crystal-lang.org/#/r/9l2e
<FromGitter> <mtsmmp_gitlab> thats what i did lol
<FromGitter> <mtsmmp_gitlab> def initialize(@config : Config = Config.new
<FromGitter> <mtsmmp_gitlab> it said "expecting 1 argument)
<FromGitter> <mtsmmp_gitlab> or something like that
<FromGitter> <mtsmmp_gitlab> when i tried that earlier
<FromGitter> <Blacksmoke16> right, but you changed `config.yml` to `config2.yml` so that would make *ALL* usages of `Config.new` use `config2.yml`
<FromGitter> <Blacksmoke16> i..e would use the same config if you did `Config.new` manually and passed it in, or if you didnt pass `.new ` any args
<FromGitter> <mtsmmp_gitlab> hm
<FromGitter> <mtsmmp_gitlab> im confused
<FromGitter> <mtsmmp_gitlab> but i see that your example works
<FromGitter> <mtsmmp_gitlab> so ill just follow that on my code
<FromGitter> <Blacksmoke16> you need to update the `Config` initialize to take the path of the config file you want that instance to use
<FromGitter> <Blacksmoke16> initializer*
<FromGitter> <Blacksmoke16> which could be defaulted to `"config.yml"`
<FromGitter> <Blacksmoke16> is Crystal your first language?
<FromGitter> <mtsmmp_gitlab> no
<FromGitter> <Blacksmoke16> 👍 gotcha
<FromGitter> <mtsmmp_gitlab> but im dumb af
<FromGitter> <mtsmmp_gitlab> for coding
<FromGitter> <mtsmmp_gitlab> although i always find a way to get what i want
<FromGitter> <mixflame> my app is out guys https://apps.apple.com/us/app/globalchat-draw/id1525630738?mt=12
<FromGitter> <mtsmmp_gitlab> > although i always find a way to get what i want ⏎ ⏎ even if i need to annoy ppl on gitter channels lmao
<FromGitter> <mtsmmp_gitlab> kidding, its the first time i do this
<FromGitter> <mtsmmp_gitlab> but i dont consider myself a good programmer at all
<FromGitter> <Blacksmoke16> no worries, was going to say this is more of a OOP question/problem than Crystal specific
<FromGitter> <Blacksmoke16> as to why the config data was shared between the two contexts
<FromGitter> <Blacksmoke16> are deff *a lot* of resources online about that, might have better luck searching for that versus Crystal in gernal
<FromGitter> <mtsmmp_gitlab> yes
<FromGitter> <mtsmmp_gitlab> im having problems with OOP
<FromGitter> <mtsmmp_gitlab> never used it before
[gnubie] has joined #crystal-lang
<FromGitter> <mtsmmp_gitlab> im not used to think using this paradigm
<FromGitter> <mtsmmp_gitlab> but you know the only thing i did different from your example
<FromGitter> <Blacksmoke16> is Python code, but seems to be a good overview of the concepts
<FromGitter> <mtsmmp_gitlab> i did this
<FromGitter> <mtsmmp_gitlab> ```config = Config.new("config2.yml") ⏎ home = Home.new.page(config)``` [https://gitter.im/crystal-lang/crystal?at=5f43ec80ec534f584fbb5ea5]
<FromGitter> <Blacksmoke16> and what does `Config` look like now?
<FromGitter> <mtsmmp_gitlab> it has different data comparing to config.yml
<FromGitter> <Blacksmoke16> i mean your `Config` class
<FromGitter> <mtsmmp_gitlab> oh
[gnubie] has quit [Remote host closed the connection]
<FromGitter> <mtsmmp_gitlab> it was something like this
<FromGitter> <mtsmmp_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f43ed0948237809373d8dd7]
<FromGitter> <Blacksmoke16> could just do `File.read(file)` no need for the interpolation
<FromGitter> <Blacksmoke16> but yea, that should do it
<FromGitter> <mtsmmp_gitlab> yeah just noticed it
<FromGitter> <mtsmmp_gitlab> the interpolation was useless
<FromGitter> <mtsmmp_gitlab> > but yea, that should do it ⏎ ⏎ yeah but it didnt work
<FromGitter> <Blacksmoke16> what was the error?
<FromGitter> <mtsmmp_gitlab> but my code isnt 100% the same of your example
<FromGitter> <mtsmmp_gitlab> there was no error, it just overwrote my Config with the Config on the initializer
<FromGitter> <mtsmmp_gitlab> but the code was different
<FromGitter> <mtsmmp_gitlab> ill check it with your example later
<FromGitter> <Blacksmoke16> ok
<FromGitter> <mtsmmp_gitlab> thanks man
<FromGitter> <mtsmmp_gitlab> sorry to bother
<FromGitter> <Blacksmoke16> np
alexherbo28 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 258 seconds]
alexherbo28 is now known as alexherbo2
alexherbo22 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo22 is now known as alexherbo2
postmodern has joined #crystal-lang
<postmodern> think i mentioned this before, but why does `crystal doc` not support the markdown syntax of [Link Title][link_id] ... [link_id]: https:/...
<FromGitter> <Blacksmoke16> prob because its really basic implementation that doesnt support all of markdown
<FromGitter> <dscottboggs> I'm so excited for this
<postmodern> also does the doc syntax not automatically link class/module names? or do i need some special linking syntax?
<FromGitter> <mixflame> I thought about it, and I think I can make the crystal server for my app open source, since I can delink servers from the master server list without any interaction from the server. but give me some time to think about it and all the risks a little more
<FromGitter> <dscottboggs> I think instance methods have to be done with `#method` and class methods with `.method`
<FromGitter> <dscottboggs> class and module names should get linked thoguh I thought?
<FromGitter> <mixflame> nice Scott, I gave you a star
<FromGitter> <dscottboggs> thanks!
<postmodern> dscottboggs, wow nice!
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/9338 just an fyi
<FromGitter> <dscottboggs> 😀
<FromGitter> <dscottboggs> would someone mind running one of the samples so I can make sure the build process works on other computers?
<FromGitter> <mixflame> I can do it later tonight if you want
<FromGitter> <mixflame> linux or OS X?
<FromGitter> <dscottboggs> 👍 thanks!
<FromGitter> <mixflame> np
<FromGitter> <dscottboggs> I've been testing on manjaro so anything other than that would be a help, but really I just wanna make sure I didn't forget something I did while trying to get it to work in the first place
<FromGitter> <mixflame> I got Ubuntu 20.04, OS X Catalina and Windows 10
<FromGitter> <dscottboggs> oh shit that's like all of them haha
<FromGitter> <mixflame> lol yup
<FromGitter> <dscottboggs> would be cool if it would work on windows but I don't think Crystal's windows support is there yet? TBH I don't follow that area too closely, haven't used windows in like 6 or 8 years
<FromGitter> <mixflame> I think it's slowly getting there
<FromGitter> <mixflame> I would have to ask a core team member
<FromGitter> <dscottboggs> works with `-Dpreview_mt` 😀
<FromGitter> <mixflame> what does that do?
<FromGitter> <dscottboggs> enables the experimental multi-threading API
<FromGitter> <dscottboggs> not that I do anything async in this even, but last time I tried to compile a project with it (admittedly very long ago) it didn't work.
<FromGitter> <mixflame> ahh nice
<postmodern> is there a macro to lookup the type of an ivar?
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> like while iterating via `@type.instance_vars`?
<FromGitter> <RespiteSage> @dscottboggs ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Looks like I'm missing at least one required package. I'm trying to figure out what I need right now, but that should probably be in the README. [https://gitter.im/crystal-lang/crystal?at=5f4416ab36e6f709fdfd3cfb]
<FromGitter> <dscottboggs> no, that's an error in the make file I just fixed, will be pushing in a sec
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/shards/blob/master/SPEC.md#libraries could use this for that kinda stuff fwiw
<FromGitter> <dscottboggs> sorry try it now
<FromGitter> <sardaukar> is there a better way to convert a byte to signed than `signed_byte = (unsigned_byte.to_i - 256).to_i8` ?
<postmodern> Blacksmoke16, used a macro to define a bunch of getters that raise a custom error if the ivar isn't set, but the ivars all have custom type signatures, so want to somehow map the @ivar type to the return type of the getter
<FromGitter> <Blacksmoke16> got an example?
<FromGitter> <dscottboggs> postmodern `(ivar = @type.instance_vars.find(&.name.== :method_name)) && ivar.type`
<FromGitter> <RespiteSage> @dscottboggs I did a `git pull` and then `make`, and it seems like the same error. Should I be on a branch or something?
<postmodern> dscottboggs, clever
<FromGitter> <dscottboggs> what's the output of `make`, and also of `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0`
<FromGitter> <RespiteSage> The output of `make` is identical to above.
<FromGitter> <dscottboggs> @mixflame just realized the makefile won't work on OSX.
<FromGitter> <dscottboggs> @RespiteSage yeah, guess I need to include instructions to install the dependencies.
<FromGitter> <RespiteSage> I suspect I'm just missing a devel package, but there's not an obvious candidate. I'll mess with it for another minute or two; I'd like to try out your samples.
<postmodern> dscottboggs, was going to suggest adding instructions for installing webkit via apt, dnf, brew
<FromGitter> <dscottboggs> thanks, I'll try to figure out the packages by looking in a docker container. Did you say you're on Ubuntu?
<FromGitter> <dscottboggs> @RespiteSage is there a webkit2gtk-4.0-dev ?
<FromGitter> <RespiteSage> I don't see it. I'm also on OpenSUSE Tumbleweed using Zypper, so I occasionally have trouble finding packages that are easily accessible on Ubuntu using Apt.
<FromGitter> <dscottboggs> ohh. I see
<FromGitter> <RespiteSage> There's `webkit2gtk3-devel`, but I don't see any dev packages for webkit2gtk4.
<FromGitter> <mixflame> does maybe homebrew or snap have it?
<FromGitter> <mixflame> not sure if snap works on SUSE but im a snap fan as of recently
<FromGitter> <RespiteSage> I have snap for Spotify; I can check there, too.
<FromGitter> <dscottboggs> that could be it, because the `4.0` in the ubuntu package refers to the version of `webkit2gtk`, and the `3` in the opensuse package might refer to GTK 3
<FromGitter> <RespiteSage> Well, I installed that package and I'm not getting the same error anymore, which *could* be progress.
<FromGitter> <dscottboggs> whooo
<FromGitter> <RespiteSage> `ld: cannot open output file ext/webview.o: No such file or directory`
<FromGitter> <RespiteSage> Where is `ext/` supposed to be?
<FromGitter> <dscottboggs> project root
<FromGitter> <dscottboggs> I'll add a `mkdir ext`, thanks
<FromGitter> <dscottboggs> this is a huge help btw thank you very much
<FromGitter> <RespiteSage> No problem. It's a really easy way to give you a quick feedback loop.
<FromGitter> <RespiteSage> Also, it looks like all the files have permissions of 644, which is weird. Maybe that's something on my end (I confess I don't know if that would get committed to the repo), but if it's not then it might be something to change.
<FromGitter> <dscottboggs> what's wrong with 644?
<FromGitter> <RespiteSage> Hm... I dunno. Maybe something's being strange for me, but I was trying to count lines with `$(find -name "*.h") | cat | wc -l`, and I'm getting a permission error on `include/webview.h`.
<FromGitter> <RespiteSage> I'll investigate further. Probably a me issue.
<FromGitter> <RespiteSage> On the other hand, it looks like everything compiled when I added `ext/`.
<FromGitter> <dscottboggs> nice
<FromGitter> <RespiteSage> Both samples seem to be working wonderfully.
<FromGitter> <dscottboggs> 🎉
<FromGitter> <dscottboggs> Updated install instructions (https://github.com/dscottboggs/webview.cr#installation) from your feedback, and the makefile should theoretically work on more OSs
<postmodern> dscottboggs, do you think this would work on macOS for installing webkit2gtk? https://github.com/jcudit/homebrew-webkitgtk
<postmodern> dscottboggs, also the OpenSUSE package will work on Fedora as well
<FromGitter> <dscottboggs> You don't need webkit2gtk on MacOS because MacOS uses a different webkit engine
<postmodern> ah
<FromGitter> <dscottboggs> same with windows, it uses the edge rendering engine there instead of webkit
<FromGitter> <dscottboggs> thanks for the tip about fedora
<FromGitter> <confact> Does it exist any book, article or docs how to optimize Crystal to run faster, using less memory and CPU and all that?
<FromGitter> <dscottboggs> theres a section of the reference
<FromGitter> <confact> @dscottboggs I know that one, was thinking one that showing more things and maybe going more in depth.
<FromGitter> <dscottboggs> anything in particular?
<FromGitter> <dscottboggs> How do I install ameba in the `latest-alpine` branch? https://pkgs.alpinelinux.org/package/edge/testing/x86_64/ameba
<FromGitter> <dscottboggs> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f442e7dc3aa024ef99b04fa]
<FromGitter> <Blacksmoke16> do you need to install it via apk?
<FromGitter> <dscottboggs> I even enabled the "edge" repository as shown here (https://wiki.alpinelinux.org/wiki/Alpine_newbie_apk_packages#coreutils_libc_and_utmps_in_alpine)
<FromGitter> <Blacksmoke16> isnt it just a shard dep?
<FromGitter> <dscottboggs> oh right of course I can just add it as `development_dependencies` thanks
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <j8r> Hum, I prefer Qt :P
<FromGitter> <j8r> Don't know if Papierkorb bindings have Qt Webview...
alexherbo2 has joined #crystal-lang
<FromGitter> <dscottboggs> Generally I like Qt better too, but I've tried to fix a few bugs in qt5.cr and I know how insanely huge the codebase is. Binding to this was 13 C functions as opposed to
<postmodern> plus webkit2gtk is much leighter than an electron app...
<FromGitter> <dscottboggs> well, @j8r's point that a Qt Webview woudl as well. I was just saying it would be less maintainable unless there was an equivalent to at least webkit2gtk, if not the webview project I bound to, because you'd need bindings to all of Qt.
<postmodern> when does and doesn't the implicit UInt to Int argument conversion apply? Just noticed a .new on a record struct didn't except Int32 when the arguments must be UInt32