<FromGitter>
<oliviahandoko> confused why it doesnt output the "What is your next question?" until the conditiona
<FromGitter>
<oliviahandoko> it only asks "What is your next question?" once
<FromGitter>
<Blacksmoke16> Setting it to false
<FromGitter>
<tenebrousedge> also do `break if question =~ /no/i`
<FromGitter>
<j8r> 7x slower for auto iter
<FromGitter>
<Blacksmoke16> `break if question.downcase == "no"`
<FromGitter>
<tenebrousedge> eh, either way
<FromGitter>
<Blacksmoke16> @oliviahandoko but you're setting `question_bool = false`, which it checked against in the `while` statement, is only true on one iteration so it stops
zorp has quit [Ping timeout: 250 seconds]
Dreamer3 has quit [Quit: Leaving...]
<FromGitter>
<oliviahandoko> thank you!
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
<Andriamanitra>
that's weird i could've sworn i have written just "getter" before and it worked
<FromGitter>
<Blacksmoke16> Correct, otherwise it defines a instance variable and getter
<Andriamanitra>
ooh, thanks i get it now
<FromGitter>
<user45789> hi
<FromGitter>
<Blacksmoke16> Hi
disruptek has left #crystal-lang [#crystal-lang]
ur5us has quit [Ping timeout: 240 seconds]
<Andriamanitra>
what does indirect initialization mean
<Andriamanitra>
I'm getting Error: instance variable '@targets' of Numbersgame::Game was not initialized directly in all of the 'initialize' methods, rendering it nilable. Indirect initialization is not supported.
<Andriamanitra>
but i do have @targets = self.get_targets in my initialize method
<FromGitter>
<Blacksmoke16> Can you make a playground link?
<Andriamanitra>
i can try, my project is using multiple files and dependencies and getting long-ish so i probably can't directly paste what i have
<FromGitter>
<Blacksmoke16> Just make sure you're assigning targets in all initializers
<Andriamanitra>
i only have one
<FromGitter>
<Blacksmoke16> Also try setting it directly versus based on return value of a method
<Andriamanitra>
is there maybe an implicit initialize method that takes no parameters?
<Andriamanitra>
nope, that didn't fix it
<FromGitter>
<Blacksmoke16> Hmm
<Andriamanitra>
it works in playground :|
<FromGitter>
<Blacksmoke16> Well you know it's the game class
<FromGitter>
<user45789> could it be that maybe self.get_targets return nothing
<FromGitter>
<Blacksmoke16> Is it a big class? A gist of it would probably be enough
<Andriamanitra>
whenever i try to come up with a simpler version of what i have it just works
<FromGitter>
<Blacksmoke16> Usually how it goes :p
<Andriamanitra>
i'm so lost here :D i swear i had this exact same code in the playground already and that time it worked https://play.crystal-lang.org/#/r/8y97
<Andriamanitra>
but now i'm at least reproducing the error, progress is happening
<FromGitter>
<Blacksmoke16> yea, just dont use `self.`
<FromGitter>
<Blacksmoke16> but really unless that `get_targets` method should be part of the public API, just do that within the constructor
<Andriamanitra>
oh right, removing "self." fixes it in the playground but not in my own code
<Andriamanitra>
also changing it to @targets = [1,2,3] fixes it in playground but not in my own code
<FromGitter>
<Blacksmoke16> are you sure you dont have any other place/methods that is setting it?
<FromGitter>
<Blacksmoke16> or if possible, a gist of the class?
<Andriamanitra>
i tried commenting out every other use of the variable besides those two with no luck
<FromGitter>
<Blacksmoke16> yea without seeing the code i dont have any suggestions, im sure its a similar case to that playground link tho
<FromGitter>
<kazzkiq> Did anybody else experienced slow installation on macOS?
<FromGitter>
<kazzkiq> I just ran `brew upgrade crystal` and it's working for about 10min now
<FromGitter>
<Blacksmoke16> :thinking: is it stuck on something?
<FromGitter>
<Blacksmoke16> depending on your internet speed, it could just be updating LLVM, which is a not small
<FromGitter>
<kazzkiq> nope, in the toolbar it keep swiching between clang/ruby stuff
<FromGitter>
<kazzkiq> and CPU is screaming here
<FromGitter>
<Blacksmoke16> i recall having something similar happen to me
<FromGitter>
<kazzkiq> And I have high-end hardware, don't remember older versions taking that long
<FromGitter>
<user45789> u can also do a really cool thing
<FromGitter>
<user45789> render ur 3d in crystal and send it trought websocket to a canvas
<FromGitter>
<user45789> tunneling the inputs and mouse position too
<FromGitter>
<j8r> I plan to send blocks/player position, then let the client render it
<FromGitter>
<user45789> yeah its pretty easy u can get it done quickly
<FromGitter>
<j8r> mouse position is not a big deal, it is just client camera. but XYZ is
<FromGitter>
<j8r> not mentioning, if there is a mismatch between client and server for the position - not that easy to deal
<FromGitter>
<j8r> because client <=> server has a latency
<FromGitter>
<user45789> yep
<FromGitter>
<user45789> u can interpolate
<FromGitter>
<user45789> if u know the player direction and the latency
<FromGitter>
<user45789> and the speed
<FromGitter>
<j8r> right
<FromGitter>
<user45789> really a facinating topic
<FromGitter>
<j8r> you work on a game?
<FromGitter>
<user45789> nope
<FromGitter>
<user45789> when i discovered godot i did a scene with multiplayer websocket and gi probes to test it
<FromGitter>
<j8r> nice :)
<FromGitter>
<user45789> i remember the problem was when a client joined the camera switched to his
<FromGitter>
<j8r> on a little side project, I'm working on a fully procedural work made with blocks (and pyramids)
<FromGitter>
<user45789> cool
<FromGitter>
<user45789> can u share some screenshots
<FromGitter>
<j8r> For now, the is no much (because I still have to do the UDP client/server)
<FromGitter>
<j8r> still, in Crystal, I was able to generate 20 millions blocks random in 30seconds using OpenSimplexNoise
<FromGitter>
<j8r> looks promising
<FromGitter>
<rishavs> thats fantastic
<FromGitter>
<user45789> yeah i saw ur repository
<FromGitter>
<rishavs> cray or crsfml?
<FromGitter>
<j8r> The author was very friendly, I have taken the maintenance of the repo :)
<FromGitter>
<j8r> @rishavs the client interface is in Godot/GDScript
<FromGitter>
<j8r> because easy, lots of resources, portable
<FromGitter>
<j8r> and Crystal as the back because portable is not as a big deal, and performance really matters
<FromGitter>
<rishavs> I never could get into godot for some reason. large engines intimidate me. something like love2d/raylib is more my speed :D
<FromGitter>
<user45789> i like raylib too, but godot is really easy
<FromGitter>
<user45789> and more clear than unity
<FromGitter>
<j8r> 3D is intimidating :$
<FromGitter>
<rishavs> yeah. 3D gets worse when you start chaining tools together
<FromGitter>
<j8r> Unfortunately, I will have to do my physics in Crystal
<FromGitter>
<rishavs> only to find that the export of one doesnt works well with another
<FromGitter>
<j8r> ha yes, I heard that
<FromGitter>
<rishavs> Can't you use something like chipmunk for that?
<FromGitter>
<user45789> do u mean blender and such
<FromGitter>
<j8r> fortunately my game is entirely procedural :P
<FromGitter>
<rishavs> not sure chimpunk has 3d support
<FromGitter>
<rishavs> I am also working on a proc game. my plan is to have a grid of rooms and corridors. Each of which can have either an enemy, or another mini game mode in it. and the players traverses through them all
<FromGitter>
<rishavs> only 2d though
<FromGitter>
<rishavs> sort of a rougue-lite
<FromGitter>
<j8r> I like this games :)
<FromGitter>
<rishavs> I did some early experiments in nim, then settled on f# (i love union types). then @oprypin , did a lot of windows work and I ened up back here hoping to play with crystal yet again :D
<FromGitter>
<rishavs> I really need to settle down on a single tool and get something done
<FromGitter>
<user45789> turns out crystal is the most powerfull one
<FromGitter>
<user45789> so friendly
<oprypin>
oh wow i had no idea there was another language where Optional is implemented through a first-class union feature
<FromGitter>
<j8r> @user45789 did you try Godot with C# on linux?
<FromGitter>
<rishavs> Crystal is indeed my favorites language, but the more I use f#, i am liking it as well
<FromGitter>
<j8r> Godot is good for the client side
<FromGitter>
<user45789> indeed
<FromGitter>
<straight-shoota> @rishavs Water in minecraft actually flows, that's not shaders but physics. But it's very rudimentary. Just like the entire engine is just based on simple blocks :=
<yxhuvud>
stephie: I agree. What would be really awesome would be something similar to how html-escaping of user supplied values work in rails, ie that people need to opt out of escaping, rather than opting in to it. I have never seen anyone do that with regards to shell escaping though
<FromGitter>
<manveru> is there a way to use `case` in ECR?
<FromGitter>
<ImAHopelessDev_gitlab> @rishavs nice! similar boat here, but i went with dlang instead of f#. really loving d
<FromGitter>
<ImAHopelessDev_gitlab> i get the crystal vibe from dlang. clean syntax, great peformance
livcd has joined #crystal-lang
<FromGitter>
<j8r> I'm gonna trust the client for most of things first, then implement anti cheat after
<FromGitter>
<user45789> just wanna say that debian 10 buster is the easest distribution to get SFML 2.51 and crystal using APT straight out the box
<oprypin>
user45789, i would argue that Arch is the easiest but whatever floats your boat
<oprypin>
the latest debian was the one that had sfml 2.3 for like a year after 2.4 came out
<oprypin>
and of course Arch has crystal in *official* repositories
<FromGitter>
<user45789> didnt know
<FromGitter>
<user45789> its kinda awesome
<oprypin>
im actually using 14 GiB of RAM
<oprypin>
169 tabs in Firefox, VM with 4GiB and of course VS code (on both systems) to top it off. but dont judge, im just trying out VS code and it's not lookking good so far
<FromGitter>
<user45789> lol
<FromGitter>
<user45789> whats ur editor for coding
<oprypin>
Kate
<oprypin>
and it's really shit in terms of Crystal support
<FromGitter>
<user45789> somebody need to make and editor just for crystal
<oprypin>
pls no :s
<FromGitter>
<user45789> maybe not xD
<FromGitter>
<j8r> 169 tabs... omg
<FromGitter>
<j8r> I tried Kate, but kept Geany because of easy basic Crystal support
<FromGitter>
<j8r> I force myself to close things I don't use , otherwise it is a mess
<FromGitter>
<j8r> in general, cleaning unnecessary data
<FromGitter>
<j8r> D is neat, why does it have not much traction?
<FromGitter>
<user45789> oprypin are you familiar in how to make crimgui work ?
<oprypin>
no never looked at it
<oprypin>
and likely never will xD
<FromGitter>
<user45789> did u know to install sfml shard if i dont specify branch master i get Missing "v2.2.0:shard.yml" for "crsfml"
<FromGitter>
<user45789> if i try to shard install with sfml branch:2.2 i get Missing "f9253349b25c1f0e01f5839b95c470f334e85d7c:shard.yml" for "crsfml"
<FromGitter>
<j8r> @Blacksmoke16 there is the `shard.lock` for that
<FromGitter>
<j8r> no need to pin in `shard.yml`
<oprypin>
user45789, what the heck no you cant use 2.2
<oprypin>
that's from times when shard.yml wasnt a thing
<FromGitter>
<Blacksmoke16> im also not saying specific version
<FromGitter>
<Blacksmoke16> yea, something like that is fine, assuming shard is following semver
<FromGitter>
<Blacksmoke16> then you get bug fixes but are protected from breaking changes and such
<oprypin>
my shard doesnt follow semver ;(
<FromGitter>
<Blacksmoke16> rip
<FromGitter>
<ImAHopelessDev_gitlab> @j8r i was wondering the same thing
ht_ has joined #crystal-lang
_ht has quit [Ping timeout: 260 seconds]
ht_ is now known as _ht
<FromGitter>
<j8r> @Blacksmoke16 yep that's the principle
<FromGitter>
<j8r> update all with `shards update`
<FromGitter>
<j8r> If everything works, great. Otherwise, rollback the lock file and pin the version, or fix the code
<FromGitter>
<j8r> pinning versions with not reasons means not having updates easily in the future, unless tracking every dependency with pinned versions regularly
skrzyp has quit [Remote host closed the connection]
skrzyp has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> bought contacts on the 2nd. still stuck in chicago (i'm in washington state). tracking hasn't been updated since the 11th
<FromGitter>
<ImAHopelessDev_gitlab> company said it's because of the "global pandemic"
<FromGitter>
<asterite> girng that's off topic
<FromGitter>
<asterite> talking about crystal lenses is fine though
Dreamer3 has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> why are the lead devs merging PRs that hide modules behind namespaces
<FromGitter>
<Blacksmoke16> because thats a good practice
<FromGitter>
<Blacksmoke16> grouping related things
<FromGitter>
<ImAHopelessDev_gitlab> no it isn't
<FromGitter>
<Blacksmoke16> yes it is
<FromGitter>
<ImAHopelessDev_gitlab> hiding it behind namespaces make it harder for the dev to find it on the docs, and second, more text to write
<FromGitter>
<ImAHopelessDev_gitlab> which goes against crystal's syntax
<FromGitter>
<ImAHopelessDev_gitlab> are you saying `require "SocketManagementFactory/socket"` is better than `require "socket"`?
<FromGitter>
<Blacksmoke16> its not hiding, its grouping
<FromGitter>
<Blacksmoke16> oh look all of the compression related modules are here in one place
<FromGitter>
<Blacksmoke16> how helpful
<FromGitter>
<ImAHopelessDev_gitlab> apply your "not hiding, it's grouping" logic to `socket` then
<FromGitter>
<Blacksmoke16> where does that happen?
<FromGitter>
<ImAHopelessDev_gitlab> we got UDPSocket, UNIXSocket, TCPServer, UNIXServer, Socket
<FromGitter>
<ImAHopelessDev_gitlab> want to hide all those behind a namespace too?
<FromGitter>
<Blacksmoke16> arguably prob will at some poit
<FromGitter>
<ImAHopelessDev_gitlab> yikes
<FromGitter>
<ImAHopelessDev_gitlab> terrible idea
<FromGitter>
<Blacksmoke16> k
<FromGitter>
<Blacksmoke16> `compress/gzip` is not that much harder than just `gzip`, esp considering these arent really used often
<FromGitter>
<ImAHopelessDev_gitlab> "slick as ruby, but wait, write colons and access that module with a namespace!" not so slick anymore.
<FromGitter>
<Blacksmoke16> plus im pretty sure you still could just do `require "gzip"`
<FromGitter>
<Blacksmoke16> nvm, its there but deprecated
<FromGitter>
<Blacksmoke16> you're overreacting again
<FromGitter>
<Blacksmoke16> these arent modules that are used that often, so doing `Compress::Gzip` once instead of `Gzip` isnt really that much more work
_ht has quit [Remote host closed the connection]
<FromGitter>
<ImAHopelessDev_gitlab> it's not, but the principal is what i'm worried about
<FromGitter>
<ImAHopelessDev_gitlab> these are core values that make the language a joy to use, the minimalistic design and slick syntax. the last thing i want is for the language to be littered with colons and added developer stress to write more text, just to access modules
zorp has quit [Ping timeout: 260 seconds]
<FromGitter>
<ImAHopelessDev_gitlab> it doesn't seem like a big of an issue because the crystal developer who has used the language for quite some time is so comfortable/used to it. ⏎ however, i put myself into the state of mind of when i first found out about crystal, that's very important. when i first started to learn, i'd be turned off heavily by colons and excessive namespace usage, i don't want that to happen
<FromGitter>
<Blacksmoke16> its a balance, not everything in the stdlib should be namespaced, i.e. i doubt you would ever have to do like `Collection::Array(Int32)` or something, but namespacing is generally a good idea. Especially when writing shards
<FromGitter>
<ImAHopelessDev_gitlab> i really hope not, but do you at least understand where i am coming from?
<FromGitter>
<Blacksmoke16> yes, and unfortunately there arent too many options to avoid long names
<FromGitter>
<Blacksmoke16> other than aliases, or including that type into another
<FromGitter>
<Blacksmoke16> ES6 import system would be 💯
<FromGitter>
<ImAHopelessDev_gitlab> never experienced that import system, but thanks for listening. and at least you know where my position is on this matter
<hightower2>
Why not G = Compress::Gzip as the first line in your code, and then do as you please with "G"
<FromGitter>
<tenebrousedge> Ruby uses colons and namespaces in the same way...
<FromGitter>
<Blacksmoke16> For reference
<FromGitter>
<Blacksmoke16> Yes, that would be an alias
<FromGitter>
<Blacksmoke16> Private aliases could work, especially private ones
<FromGitter>
<Blacksmoke16> Oops
<FromGitter>
<Blacksmoke16> A large majority of languages use namespacing, most just have some built in way to make it so you don't need to use the fqn all the time in a given file
<FromGitter>
<Blacksmoke16> Ruby, and by extension don't
<FromGitter>
<Blacksmoke16> Crystal*
DTZUZU has quit [Ping timeout: 240 seconds]
<FromGitter>
<ImAHopelessDev_gitlab> i'll send an email/message to brian and ask him to add a namespacing example on the front page
<FromGitter>
<Blacksmoke16> Probably not really needed but okay
<FromGitter>
<Blacksmoke16> It would essentially just be an example of modules
<FromGitter>
<ImAHopelessDev_gitlab> my point is: it's un-crystal like
<FromGitter>
<ImAHopelessDev_gitlab> i was being sarcastic
<FromGitter>
<Blacksmoke16> its not un-crystal like tho
<FromGitter>
<ImAHopelessDev_gitlab> i doubt they'd want an example on the front page of example code littered with colons and namespaces.
<FromGitter>
<Blacksmoke16> its a core part of crystal if anything
<FromGitter>
<Blacksmoke16> lol k
<FromGitter>
<Blacksmoke16> heres a question for you then
<FromGitter>
<Blacksmoke16> say you make a shard called `MyShard`
<FromGitter>
<Blacksmoke16> and i make a shard called `MyShard`
<FromGitter>
<Blacksmoke16> and within these shards we define a `Client` class
<FromGitter>
<Blacksmoke16> w/o using namespaces
<FromGitter>
<Blacksmoke16> and someone installs both of our shards as they provide different functionality
<FromGitter>
<tenebrousedge> the work required to implement `import Foo as F` seems way out of proportion with the benefits. Assuming that's the preferred idea
<FromGitter>
<ImAHopelessDev_gitlab> we'll, i'd use different names for my shards. kinda like methods should all be uniquely named (method overloading is confusing and a ambiguous nightmare)
<FromGitter>
<Blacksmoke16> how would you use the `Client` class from my shard versus the one from your shards?
<FromGitter>
<tenebrousedge> method overloading is also a core part of Crystal
<FromGitter>
<Blacksmoke16> So you would name your client class as `SomeUniqueNameClient`
<FromGitter>
<ImAHopelessDev_gitlab> i'd just name it differently
<FromGitter>
<Blacksmoke16> the name of the shard in the case isnt really the point, the point is two `Client` classes that do different things defined on the top level namespace would conflict
<FromGitter>
<Blacksmoke16> but you wouldnt know about my shard
<FromGitter>
<Blacksmoke16> so how would you make sure you name is differently then every other shard out there that may be defining stuff on the top level?
<FromGitter>
<tenebrousedge> and as the third-person developer what is your solution? just don't use one or the other library?
<FromGitter>
<ImAHopelessDev_gitlab> by not installing those shards that have that name lol
<FromGitter>
<Blacksmoke16> great solution
<FromGitter>
<tenebrousedge> do you check every class that every shard you use to make sure they don't conflict?
<FromGitter>
<Blacksmoke16> i meant to be fair he's right, but ofc its not an actual solution if you need/want to use two shards that have a conflict in a type name
<FromGitter>
<Blacksmoke16> hence namespacing
<FromGitter>
<Blacksmoke16> and why its useful
<FromGitter>
<Blacksmoke16> `SomeShard::Client` versus `OtherShard::Client`
<FromGitter>
<Blacksmoke16> two unique types, no longer conflicting
<FromGitter>
<tenebrousedge> other languages learned this, to their cost. PHP didn't have namespacing for a long time. It was ugly
<FromGitter>
<ImAHopelessDev_gitlab> i agree it can be useful, but just don't think the language should have PRs merged that increase the chances of the average crystal developer to have to use them..
<FromGitter>
<Blacksmoke16> have you actually ever used any type that those PRs affected?
<FromGitter>
<Blacksmoke16> chances are no. I used `Gzip` once, so chances are the avg dev wont need them, so all they are doing is polluting the top level namespace
<FromGitter>
<Blacksmoke16> so needing to do `Compress::Gzip` that one time is not a big deal for how often these things are used
<FromGitter>
<Blacksmoke16> one thing that will be nice is namespacing things within docs but not actually changing the types
<FromGitter>
<ImAHopelessDev_gitlab> not yet, but scared it might set a precedent and foundation of it happening to other classes. then the new crystal dev in 3-5 years has to deal with them (which most likely might be a turn off). "oh wow, this syntax is so slick!", 5 minutes later, `require "SocketFactory/socket"`...
<FromGitter>
<Blacksmoke16> i doubt people choose not to use a language because that have to type some `::` a few times
<FromGitter>
<Blacksmoke16> in other languages having that style of require/imports prevents you from including code that you're not using
<FromGitter>
<ImAHopelessDev_gitlab> true, but i believe it diminishes the beautiful syntax we already have
<FromGitter>
<ImAHopelessDev_gitlab> it's like a diamond, why rough it up
<FromGitter>
<Blacksmoke16> crystal doesnt need that as unused stuff is just not included in the binary
<FromGitter>
<Blacksmoke16> yes, which is why you dont namespace everything
<FromGitter>
<Blacksmoke16> `Crystal::Int32` is overkill
<FromGitter>
<Blacksmoke16> or `Crystal::Collection::Array`
<FromGitter>
<ImAHopelessDev_gitlab> only time a diamond needs to be cleaned, is if it's dirty. doing `require "socket"` is the *total opposite* of being dirty
<FromGitter>
<Blacksmoke16> because needing to add a `/tcp` to that would totally be game over
<FromGitter>
<ImAHopelessDev_gitlab> core values and principles!
<FromGitter>
<Blacksmoke16> i do that with `HTTP` stuff, `require "http/client"` if i only want to use the client
<FromGitter>
<Blacksmoke16> makes intent more clear
<FromGitter>
<Blacksmoke16> and i like to think it makes a small diff in compile time as im not requiring stuff i dont need
<FromGitter>
<ImAHopelessDev_gitlab> i don't mind something like that, i mean require "SocketFactory/socket" or SocketFactory::TCPServer.new
<FromGitter>
<ImAHopelessDev_gitlab> stuff like that
<FromGitter>
<ImAHopelessDev_gitlab> in fact, i agree with you there. http/client is more clear
<FromGitter>
<Blacksmoke16> well at that point its not a factory :P if anything i could see `Socket::TCP.new`
<FromGitter>
<ImAHopelessDev_gitlab> don't mind that
<FromGitter>
<Blacksmoke16> mhm
<FromGitter>
<ImAHopelessDev_gitlab> if dev can do TCPServer.new
<FromGitter>
<Blacksmoke16> id be in favor of moving this stuff to some common thing, i dont think they're used often enough to warrent having like tcp server/socket, udp socket, unix server/sock on the top level
<raz>
law #4 of the internet
<raz>
the tiniest things get the biggest debates
<raz>
:p
<FromGitter>
<jwaldrip> Does anyone have experience with clear?
<FromGitter>
<Blacksmoke16> I used it a while ago, why?
FromGitter has quit [Remote host closed the connection]
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
FromGitter has joined #crystal-lang
<FromGitter>
<user45789> clear linux ?
<raz>
clear ORM probably
<FromGitter>
<jwaldrip> Clear ORM
<FromGitter>
<jwaldrip> Having an issue with CTEs.