RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
sevensidedmarble has joined #crystal-lang
sevensidedmarble has quit [Ping timeout: 264 seconds]
zorp has quit [Ping timeout: 272 seconds]
_whitelogger has joined #crystal-lang
sevensidedmarble has joined #crystal-lang
sevensidedmarble has quit [Max SendQ exceeded]
sevensidedmarble has joined #crystal-lang
sevensidedmarble has quit [Read error: Connection reset by peer]
Cyrus has quit [Quit: brb]
<FromGitter> <ninetailschris> I found the problem it was update_by apparently ruby datetime format for it throws errors in crystal.
Cyrus has joined #crystal-lang
<FromGitter> <ninetailschris> I have one last question. When using user = MyRepo.get!(User, 1) Could I simply do puts user.id or is there an extra step?
_whitelogger has joined #crystal-lang
<FromGitter> <ninetailschris> Anyone know of this error ? undefined method 'name' for Nil (compile-time type is (Player | Nil))
_whitelogger has joined #crystal-lang
<FromGitter> <asterite> ninetailschris https://crystal-lang.org/api/0.26.0/Nil.html
<FromGitter> <asterite> Also read the language docs, specially union types, if var
_whitelogger has joined #crystal-lang
<FromGitter> <Timbus> the 'if var' docs really need a better title. it's likely that people skip over it and miss how to deal with the union types
<FromGitter> <Timbus> guess there is 'if var.nil?' though. maybe some people will always miss it
<FromGitter> <Timbus> mebe a 'how to deal with nils' would be a pretty good ref.
_whitelogger has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 258 seconds]
Raimondi^1 has joined #crystal-lang
Raimondii has quit [Ping timeout: 240 seconds]
Raimondi^1 is now known as Raimondi
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
DTZUZO has quit [Ping timeout: 244 seconds]
<FromGitter> <schoening> What is the name of a class that is an array but also stores the index positions in a hash for O(1) index finding? Must be a word for it, I'm not the first one to try this, otherwise give me a nobel prize please
DTZUZO has joined #crystal-lang
<FromGitter> <yxhuvud> sorry to break it but there are no computer science nobel prize.
<FromGitter> <Timbus> I guess the generic term would be an ordered hash?
<FromGitter> <Timbus> or ordered associative array
livcd_ has quit [Remote host closed the connection]
livcd has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
ashirase has quit [Ping timeout: 272 seconds]
ashirase has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 252 seconds]
ua__ has joined #crystal-lang
ua_ has quit [Ping timeout: 244 seconds]
<FromGitter> <kolyaio> Trying to install 0.25.1 via crenv but i got the following error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b83c99ff86b741b05cc234d]
<FromGitter> <kolyaio> I’m using MBP 15 macOS version 10.13 ⏎ ⏎ Using version crenv 1.1.0-9-gf6f472f
<FromGitter> <vegai> go-style concurrency can be a bit sad :-/ https://github.com/hashicorp/nomad/pull/4608
<FromGitter> <sdzyba> currently Crystal's fibers are executed in a single thread so I guess you can't have a race condition :)
<FromGitter> <vegai> yeah. I imagine some hell breaking loose if the multithread thing ever becomes a thing and people switching it on without thinking too much :P
<FromGitter> <yxhuvud> Well you can if the thread preempt itself.
<FromGitter> <yxhuvud> Or fiber, rather.
ua_ has joined #crystal-lang
ua__ has quit [Ping timeout: 268 seconds]
<FromGitter> <diegogub_gitlab> hi guys, im in a urgent issue! I can't get my HttpClient to resolve on a docker
<FromGitter> <diegogub_gitlab> anyone has a idea?
<FromGitter> <diegogub_gitlab> if I login to the docker, and ping to the domain it works..
<FromGitter> <diegogub_gitlab> but not from my binary
<FromGitter> <diegogub_gitlab> :*
<FromGitter> <diegogub_gitlab> :(
<FromGitter> <j8r> an issue already exists, let me search
ua__ has joined #crystal-lang
<FromGitter> <j8r> which duplicates others issues
ua_ has quit [Ping timeout: 268 seconds]
Groogy has joined #crystal-lang
shalmezad has joined #crystal-lang
zorp has joined #crystal-lang
flaviodesousa has joined #crystal-lang
alex`` has joined #crystal-lang
gtramontina has joined #crystal-lang
atna has joined #crystal-lang
<atna> How can I return a parent class instance from a method? I thought self.as(ParentClass) would work, but it still returns ChildClass (when ChildClass < ParentClass < BaseClass, at least)
<atna> i.e., I'm trying to write a midcast() function which will only downcast to midway in the class hierarchy, and I'm writing it in the ParentClass. But it's returning ChildClass, which I don't want.
<Groogy> casting it to ParentClass makes it ParentClass+
<Groogy> and the type inference will try and solve it to be ChildClass
<Groogy> why do you need this "midcast()"?
<atna> I was attempting to register instances as values in a hash, where the key is the mid-class. I want to register the behaviour class, not the implementation of the behaviour.
<atna> I've gotten further by explicitly returning the class I want to register, but it's not quite as nice.
<atna> i.e., I want to be able to look up a class to get a certain behaviour (Animal, say), and then have the implementation that was registered do the work (Bark, or Moo, or whatever).
<atna> It's OK, there are other ways to skin this, if the type system is going to insist on downcasting.
<atna> It does seem strange though, that asking for a ParentClass gets you a ParentClass+. Seems like the pointer types are being conflated with what's pointed to there.
<Groogy> eh there's no pointers in Crystal
<Groogy> you seem to be thinking of this as if it is C++
<Groogy> You should be going with a Duck typing mind when you work with these kind of things. I've played around a lot with types and for me it's been more of a case ensuring that I have the most final type at all times to improve how the code looks and how it performs
<Groogy> since you don't need to do lookup on the type id to resolve calls
<Groogy> Or well I misspoke, there are Pointers, it's a specific class to mainly be used with integrating with C libraries
<atna> Yeah, I meant in the implementation details.
<FromGitter> <codenoid> hi
<atna> Never mind, think I have it working now :)
<FromGitter> <codenoid> is save firefox profile not available in crystal selenium driver
<Groogy> But yeah every variable is a union of types and a reference to memory. On runtime when you access the variable it needs to resolve what type it is and it will always resolve to the final type
<Groogy> So thinking it of as "this is a pointer to the base class" makes no sense. the ParentClass+ just means that the variable when resolving can be ParentClass or any of it's subclasses
<atna> Groogy: I see, thanks. Was going to check how that's done later on. You've saved me the trouble :)
<Groogy> You should try and solve your problem not in a C/C++ way but in Ruby/Crystal style :) if you don't need to define the type, then why do it? If it barks like a dog, walks like a dog and smell like a dog. It's probably a dog
<atna> I think just returning the actual type I want rather than trying to derive it from self is more correct in this case anyway :)
<atna> I DO need to define the type. I'm implementing a type system of sorts (an ECS)
<Groogy> no I mean in return type/storage etc
<Groogy> also keep in mind that the Classes are different types
<Groogy> they do not inherit from each other
<atna> On a related note... x.as(y) wants a constant for y, and not a variable refering to some type, is that correct? Is there any way to dynamically name what you want something downcasted to?
<Groogy> FooClass < ParentClass; BarClass < ParentClass; BarClass.is_a?(ParentClass.class) is false, there's no common heritage between FooClass and BarClass
<Groogy> For that you need to use macros
<Groogy> I'll show you an example
<Groogy> or actually yeah I solved it without a macro
<Groogy> the class in itself has a cast method that will cast the type of the variable to your type
<atna> Hah, you wrote an ECS too. I couldn't find one on crystalshards :)
<Groogy> eh not fully
<Groogy> It's an ECS like system
<Groogy> There's a lot of pains with using a pure ECS architecture so I cheat
<atna> Yeah, every ECS implementation I've looked at seems quite different :)
<atna> Well, this was my first crystal project, so I'll have a look at yours and see what I can pick up :)
<Groogy> for instance I know every single instance has a position in the world, so instead of having a PositionComponent I just bake that into the Entity directly
<atna> Ahh, I see :)
<Groogy> and have abstract structs to let me define different behaviour depending on what kind of position
<Groogy> if you are doing a game you can use Boleite to setup graphics etc.
<Groogy> framework is not entirely done but it's good enough for 3D and 2D
<atna> Very cool :)
atna has quit [Ping timeout: 252 seconds]
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<Groogy> hmmm so I am trying to get it so shards can fetch from my fork on one of the dependencies of my framework but it's failing
<Groogy> git command failed: git ls-tree -r --full-tree --name-only v0.1.1 -- shard.yml (). Maybe a commit, branch or file doesn't exist?
<Groogy> the original repo seems dead so I am trying to fix the users errors in my own fork
<Groogy> is it not capable of fetching from my fork and only from the original repo even if I specify it to take my repo?
<z64> Groogy: the problem is that they tagged v0.1.1 but `shard.yml` says the latest is `v0.1.0`. add `branch: master` to your deps (or fix shard.yml)
<Groogy> ah wait I can fix that
<Groogy> I'm also asking Github to make my fork independent since that repo seems dead
<Groogy> hmm no even if I upped the version to be 0.1.1 it is still not finding the commit
<z64> Groogy: did you actually fix *the tag*?
<z64> shards is going to checkout the tagged commit v0.1.1, and the code in that tag will have the wrong shard.yml
<Groogy> yeah I did
<Groogy> I think it is looking up the original repository or something
<Groogy> and the commit doesn't exist there
<z64> you did tag "0.1.1" not update "v0.1.1"
<Groogy> oooh
<Groogy> that solved it
<z64> cool
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 244 seconds]
<FromGitter> <styler1972> hey im looking for your opinions on whether or not crystal is production-ready enough to be used to write an API for a minimally viable version of a mobile app :) i'd love to start using it
<Groogy> z64 you know if the libraries: key in the shards.yml does anything? I don't see anything change over it but noticed in some other shards.yml
<Groogy> @styler1972 you would probably need to write all the libraries yourself
<Groogy> but I for instance can setup an ES opengl context with my framework if I want to
<FromGitter> <j8r> If production ready means only very few runtime errors (except conceptual one), yes.
<FromGitter> <j8r> The most important is to write tests, and continuous development on Crystal:latest, because of various fixes/improvements.
<FromGitter> <girng> @Timbus u mean like a hash?
<Groogy> ah thx
<FromGitter> <j8r> Crystal isn't production-ready for one shot apps, develop and forget. If you do you will be 10 versions behind latest, R.I.P.
<FromGitter> <girng> @Timbus For example look here (https://i.gyazo.com/dd345071bf05156185fda29a0a8d7554.png) at the `items` property. acts like a js object in nodejs, except the properties of item are only item_name, name, pos
<Groogy> there first version tagged and have a usage example for Boleite: https://github.com/Groogy/boleite
<Groogy> though boy that's a pretty hefty usage example, should put some work into making the most basic usage a bit simpler
DTZUZO has quit [Ping timeout: 264 seconds]
gtramontina has quit [Remote host closed the connection]
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<FromGitter> <girng> btw is @faustinoaq still active i miss him
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
gtramontina has joined #crystal-lang
wontruefree has joined #crystal-lang
gtramontina has quit [Ping timeout: 268 seconds]
<FromGitter> <rishavs> Is there a way for me to get a time object from a database call? Maybe something like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ My time data for created_at has this value `2018-08-22 12:58:20 +0000` ... [https://gitter.im/crystal-lang/crystal?at=5b8433409c71d363c138db3e]
<FromGitter> <fridgerator> @girng he left this command a few days ago : https://github.com/amberframework/amber/issues/938#issuecomment-415842548
<z64> @girng don't know exactly, but see https://github.com/amberframework/amber/issues/938#issuecomment-415842548 ; seems like he's been taking a break from crystal for now
<FromGitter> <fridgerator> lol
<z64> but oop:)
<FromGitter> <girng> i see. must be from that one reddit thread
<FromGitter> <girng> i hope he comes back
<z64> @rishavs does that not work as-is? i use `DB.mapping` with `Time` fields, that should basically be expanding to something similar
<FromGitter> <rishavs> I am using raw queries. But damn, i never did check if that worked. I assumed Time is not a type that I can use. I'll quickly check and come back with the output
<FromGitter> <girng> time.now.epoch_ms i just use as a 0_i64
<FromGitter> <girng> ok to do, right?
gtramontina has joined #crystal-lang
<FromGitter> <rishavs> wow. I am an idiot. this actually works o.0 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b84353fac25fd11b5a13302]
<z64> awesome :)
gtramontina has quit [Ping timeout: 272 seconds]
<FromGitter> <girng> where unqid = $1 and = ? same thing?
<FromGitter> <girng> what does the number represent
<FromGitter> <girng> what if you do = $4?
<FromGitter> <rishavs> thats same as ? In postgres we use $n instead
<FromGitter> <girng> o, ty
<FromGitter> <rishavs> you can also use the in-string thingie as; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b8436807649b9063e10bcd6]
<FromGitter> <vladfaust> I've been moving Core to a higher level of abstraction this weekend and it goes well. In short, Core will be a foundation ORM for others; current Core will turn into Core::DB
<FromGitter> <vladfaust> It'll be possible to easily create ORMs for both row and column oriented backends
akaiiro has joined #crystal-lang
<FromGitter> <vladfaust> I'm also working on https://github.com/crystaljobs to create a place for Crystal developers to get hired
akaiiro has quit [Remote host closed the connection]
akaiiro has joined #crystal-lang
<FromGitter> <vladfaust> "Wow, these are great contributions to the ecosystem man, keep on!"
<FromGitter> <rishavs> What do you mean by "foundation ORM"? will other ORMs like Granite, crecto etc use Core internally?
<Groogy> also I am wondering when should I ask to have Boleite put on awesome-crystal? 😂
<Groogy> oh that's wrong emoji, was supposed to be 🤔
<Groogy> IT's usable right now but there's tons of more stuff I want to add, like audio etc.
<FromGitter> <vladfaust> @rishavs I highly doubt so. The truth is that there are backends other than PostgreSQL, MySQL and SQLite. Core would carry lots of general ORM stuff (schema definition, repositories, backend requests logging, model references) and a developer would only need to write a code tro interact with the backend itself (querying and mapping).
<FromGitter> <bararchy> @bcardiff you really need to automate binary signing :)
<FromGitter> <bcardiff> I haven't even request the binary singing. The test-ecosystem is a bit slow (it does a lot of things). And every last minute PR delays a bit. Because at least I want to do a smoke test in some platforms. Summing up the build process and its queue, it's easy to reach a minimum of ~2hs before actually tagging to launch the final build.
<FromGitter> <fridgerator> @vladfaust I dont follow, it just sounds to me like you're making another ORM
<FromGitter> <vladfaust> Core is already here for a year, I'm splitting it to foundation and DB adapter
<FromGitter> <vladfaust> Foundation would help to create ORMs for other back-ends quickly
<FromGitter> <paulcsmith> I'm attempting to install Crystal 0.26.1 from the releases tab in GitHub. I've got it downloaded and copied the binary in `bin/crystal` to somewhere in my PATH (/usr/local/bin) but when I run `crystal -v` I get: `You need to have a crystal executable in your path!` Has anyone seen this before?
<FromGitter> <DanielSokil> @vladfaust Have you consider writing the front-end for Crystal Jobs in Mint? https://www.mint-lang.com
wontruefree has quit [Quit: bye]
<FromGitter> <j8r> @paulcsmith there is the `crystal` binary and the `crystal` shell wrapper
<FromGitter> <j8r> @girng There are chances that @faustinoaq is now stuck in an Amber at this time 😄
<FromGitter> <girng> how can we free him??
<FromGitter> <paulcsmith> @j8r So did I move the wrong file? I'm not sure I understand
<FromGitter> <j8r> The script wrapper doesn't find the crystal binary in your PATH
<FromGitter> <fridgerator> @girng have you ever seen Jurrasic Park?
<FromGitter> <girng> @paulcsmith are u on WSL?
<FromGitter> <paulcsmith> No I'm on macOS
<FromGitter> <paulcsmith> @j8r I see the problem, I don't know how to fix it, but thanks for linking to the code
<FromGitter> <j8r> you have to place the crystal binary in your path, the script wrapper can be placed where ever you want
<FromGitter> <girng> @fridgerator nope
<FromGitter> <fridgerator> it would answer your question ;)
<FromGitter> <paulcsmith> I put the binary in my path so I'm not sure what I did wrong. I'll mess around with it
<FromGitter> <rishavs> So we need to splice his DNA with that of a frog?
<FromGitter> <girng> @fridgerator maybe i should watch it :D @paulcsmith try this: https://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html
<FromGitter> <j8r> oh no got it @paulcsmith
<FromGitter> <paulcsmith> @girng That will work for the latest released version, but 0.26.1 isn't on homebrew yet
<FromGitter> <paulcsmith> Might be soon though. We'll see
<FromGitter> <j8r> you have to follow a hierarchy
<FromGitter> <j8r> `bin/crystal` ⏎ `lib/crystal/lib/libgc.a` ⏎ `lib/crystal/bin/crystal` ⏎ `lib/crystal/bin/shards` [https://gitter.im/crystal-lang/crystal?at=5b844d2ffd3c641b06199f3d]
<FromGitter> <j8r> exactly like in the release archives https://github.com/crystal-lang/crystal/releases
<FromGitter> <fridgerator> 1) 26.1 is tagged already? wow
<FromGitter> <fridgerator> @rishavs yep, exactly
<FromGitter> <paulcsmith> @j8r Ohh ok I'll give that a try. Thanks!
<FromGitter> <girng> why isn' the latest crystal supported on mac??
<FromGitter> <girng> it's on WSL
<FromGitter> <j8r> so for you @paulcsmith , try: ⏎ `/usr/local/bin/crystal` <= shell script ⏎ `/usr/local/lib/crystal/lib/libgc.a` ⏎ `/usr/local/lib/crystal/bin/crystal` <= binary (huge size compared to the script wrapper) ⏎ `/usr/local/lib/crystal/bin/shards` [https://gitter.im/crystal-lang/crystal?at=5b844db3e5b40332ab07fbc6]
<FromGitter> <paulcsmith> @girng it was just barely released. It hasn't quite been merged into homebrew yet
<FromGitter> <j8r> personally I prefer to place everything in my `$HOME/.local`
akaiiro has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> @paulcsmith how long does that take, who manages homebrew, Apple?
<FromGitter> <girng> i've never used macos so not sure sorry
<FromGitter> <paulcsmith> Someone from the Crystal team needs to make a PR to the homebrew core GitHub repo. Once they review it they merge it and everyone using homebrew can use the new version
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter> <girng> @paulcsmith can i do it?
<FromGitter> <girng> or maybe you can try since u know more about mac stuff i'm sure they'll accept the pr
<FromGitter> <paulcsmith> I am not sure. I think someone from the Crystal core team has to do it. Maybe someone else can though
<FromGitter> <paulcsmith> I don't have time to do that until later this evening unfortunately :(
<FromGitter> <paulcsmith> Otherwise I would. I also have a bunch of stuff to do with Lucky to get ready for the next release :)
<FromGitter> <girng> :D
akaiiro has joined #crystal-lang
<FromGitter> <asterite> @paulcsmith actually anyone can send that PR, not just someone from the Crystal core team. The guys at homebrew mostly don't know/care how sends the PRs as long as they build/pass. It happened in the past that our formula was updated/changed without any of us noticing it
<FromGitter> <asterite> how -> who
<FromGitter> <girng> i will try, i'm going in
<FromGitter> <paulcsmith> Good luck :)
<FromGitter> <asterite> @girng Just note that until the release tar.gz is uploaded here: https://github.com/crystal-lang/crystal/releases/tag/0.26.1 then there's no possible way to send that PR to homebrew
<FromGitter> <asterite> (so you'll have to wait anyway)
<FromGitter> <girng> aww ok
<Groogy> ah dang it screwed up my pull request now I can't do a seperate commit for Boleite as well 😅
<FromGitter> <jwoertink> I have the jurrasic park theme stuck in my head now.
<FromGitter> <j8r> Thats bad security-wise, there is no package maintainer in homebrew?!
<FromGitter> <j8r> I love Alpine Linux for this 😀
<FromGitter> <girng> i love WSL
<FromGitter> <j8r> The minimalism, the security, OpenRC. They close the gap to BSDs
<FromGitter> <asterite> Actually, it seems some homebrew maintainers kind of know how to ask when there's an incoming PR, like here: https://github.com/Homebrew/homebrew-core/pull/15035#issuecomment-311572440 . But it happened in the past that a few PRs to the crystal formula were merged without me or anyone else in the core team knowing... it's how homebrew can evolve in a decentralized way
<FromGitter> <j8r> I also remember of macports, what about it?
akaiiro has quit [Remote host closed the connection]
<FromGitter> <j8r> Hu wtf
<FromGitter> <girng> who's dat?
atna has joined #crystal-lang
<FromGitter> <j8r> A member of manas, but the other (that I've seen in the @asterite homebrew link) has the same name.
<FromGitter> <girng> multi account user! reported directly to github admins.
<FromGitter> <girng> jkjk! rofl
<FromGitter> <j8r> I really doubt @girng
<FromGitter> <j8r> It would be the worst undercover, just two people with same name, maybe
<FromGitter> <j8r> And asterite has chosen the wrong
<FromGitter> <girng> > They see me trollin'
<atna> Questions:
<atna> AND, if it's a properly suppoorted extension mechanism, can I do this with an enum, to extend the items in the enum? Or is there another way to add enum values outside of the module that creates the enum?
<atna> What exactly is this doing, when it (re)defines the Object class and adds methods? https://github.com/sam0x17/truthy/blob/master/src/truthy.cr
<FromGitter> <j8r> This is called monkey patching, you can add methods to existing classes, modules, structs...
<FromGitter> <girng> is that good practice?
<robacarp> it's risky to do that to parts of the stdlib
<atna> j8r: I'm familiar, from Python. But... the mechanism is unclear (precedence if two different modules do this, etc.). Can you point me to docs on it?
<FromGitter> <j8r> Better to avoid monkey patching. If you do this all over the place, obviously you decrease the maintainability
<FromGitter> <girng> what's the difference between monkey patching and creating your own macros??
<atna> j8r: it looks like the only way to achieve after-the-fact (after-the-module) extensibility, though, right? i.e., adding methods to other shards' classes?
<FromGitter> <j8r> The best way is to `include ModuleOfTheShard` in your `module MyModule`
<FromGitter> <j8r> And then adding your methods on `MyModule`
<FromGitter> <j8r> But for the enums I don't know
<FromGitter> <j8r> What do you want to do by extendinf the enum?
<robacarp> yes, favor composition over extension
<FromGitter> <j8r> @girng Monkey patching is adding thibgs to existing objects, with macros or not
<atna> j8r: I think the include would work to add functionality that MyModule wanted, but not to provide functionality to all modules, right? So if wanted Int32 in any shards' modules to be able to auto-accept my new BigInt class as well, I'd need to do something fancier?
<atna> any shards methods, that is.
<atna> j8r: for enums, I like the pattern of defining allowed hash keys, and extending those with plugins.
<FromGitter> <j8r> In this case, if you want to extend the stdlib's or another shard BigInt, yes, you have to monkey oath atna
<atna> Fair enough. It's nice to know such things are possible, in a compiled language :)
<FromGitter> <j8r> That's at compile time, and I would say its better to use it a temporary solution (e.g. waiting a feature to be merged)
<FromGitter> <eliasjpr> Has there been any effort to optimize the Crystal-DB shard?
<atna> BTW, I threw this together yesterday and today (between E:D games :D), as my first non-hello-world Crystal code: https://github.com/lee-b/crystal-ecs Development went pretty quickly, for an almost completely new language (very little Ruby as well). I'm impressed. Very cool language :)
<FromGitter> <j8r> A lot better to fork the shard, and add mehods. The additions could have side effects, specially in Classes. You'll be able to have stronger tests
<FromGitter> <j8r> atna: we can see you come from Python, with the empty `()` 😄
<atna> lol :)
<atna> Also C/C++ etc. I finally managed to stop writing (void) :D
<oprypin> D:
<FromGitter> <j8r> Haha
<atna> And now you're telling me to drop the () too? Madness. Soon there'll be no methods at all! ;)
<oprypin> atna, i can answer things from Python perspective
<atna> Cool, thanks :)
<atna> I'm satisfied for one day/weekend. Gonna go grab some tea, watch a TV show, and hit the hay :)
<atna> It's so nice, finding a new language you like. I thought Rust was going to be my new language, but I think this is going to overtake it for most purposes :) Especially with the ability to call Android UI code already and stuff like that.
<FromGitter> <ryanprior> atna: I see you doing things like `pet_name = pet.pet_name()`. You might like the language even more if you called the method `name()` instead of `pet_name()`. Then instead of creating a variable and substituting `"#{pet_name}"`, you can just substitute directly: `"#{pet.name}"`. Even without the open-close-parens, method invocation is implied.
<FromGitter> <girng> @j8r ty
<atna> ryanprior: I generally avoid that because method names aren't namespaced
<FromGitter> <j8r> There are a lot more to say, but for a first day of Crystal that's a lot better that me :)
<FromGitter> <ryanprior> Of course, there's tricks to do the same thing in Python with properties, etc.
<atna> At least, they aren't in python. In c++ I suppose. Not sure what Crystal would do if two mixins had the same method?
<FromGitter> <ryanprior> If two mixins have the same method, you get the one included last if you use it "plain", but it's better to be explicit and call `my_mixin::method`
<atna> No doubt there's tons of room for improvement. It's a lot more functional than my first Rust project was after two days though :D
<FromGitter> <ryanprior> You're doing great!
<atna> ryanprior: ahh, OK, so yeah, I could drop the prefixes then :)
<atna> Thanks :)
<FromGitter> <girng> https://github.com/lee-b/crystal-ecs/blob/master/src/ecs.cr#L52 what is arrow function in crystal do? never seen it before
<atna> girng:The => ? It's defining the types of the key => value in the hashset.
<FromGitter> <j8r> That's an alternate constructor for `Hash(Object, Object)`
shalmezad has quit [Quit: Leaving]
<FromGitter> <j8r> .new
<FromGitter> <girng> wtf..
<FromGitter> <ryanprior> @girng the name for it is a "hash literal"
<FromGitter> <ryanprior> Similar to how you can write `['one', 'two']` you can write `'one' => 'two'`
<atna> Yeah, I think I prefer the more standard form of just saying HashSet(Component.class, Set(Entity)).new
<FromGitter> <girng> so it's like shorthand notion? both can work just fine?
<FromGitter> <girng> notation*
<FromGitter> <j8r> https://carc.in/#/r/4tth
<FromGitter> <ryanprior> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b8468927649b9063e11f1ea]
<FromGitter> <j8r> There is the same for `Array`
<atna> I think I used that form because the compiler suggested it, but I'm not sure now.
<atna> Where it came from, I mean
<FromGitter> <j8r> They should remove this IMO >.<
<atna> lo
<atna> lol
<FromGitter> <girng> so it's just diff syntax ok got it
<atna> It does seem unnecessary.
<FromGitter> <girng> i was just worried for a second i thought there was a new feature or something from 0.24 rofl
<FromGitter> <girng> cuz i've been away for several months :D
<FromGitter> <j8r> Yes. For array it's a bit different, there is a rare case when its useful
<atna> Though maybe you need it for coding without stdlib or something
<FromGitter> <ryanprior> By way of explanation: Crystal's syntax is inspired by Ruby, which has syntax inspired by Perl, which has syntax inspired by the second circle of hell
<atna> Yeah, I've seen enough perl to avoid it like the plague :D
<atna> Anyway, time I was leaving. Thanks guys :)
<FromGitter> <girng> goodbye see u
<FromGitter> <j8r> https://carc.in/#/r/4ttw
<FromGitter> <j8r> Bye
<oprypin> atna, the compiler did suggest it, u write `a = {}` and it says `for empty hashes use '{} of KeyType => ValueType'`
<FromGitter> <girng> i'm committed 100% to crystal. i was "program language hopping" several months ago. tried a bunch of diff languages. elixir, nim, etc. got sick of it and always came back to crystal!
<FromGitter> <ryanprior> Are you using crystal with Godot, @girng?
<FromGitter> <j8r> And yeah, your come always back to your first love, Crystal 😄
druonysus has joined #crystal-lang
<FromGitter> <girng> @ryanprior yep, for game server. godot's tcp works beautifully with crystal's tcpserver
<FromGitter> <ryanprior> anything open source where I can see what you mean?
<FromGitter> <j8r> I hope @girng will bring us a godot api wrapper shard :)
<FromGitter> <girng> rofl
<FromGitter> <ryanprior> Is there a shorthand for invoking procs in Crystal? eg: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b846ee3d8d36815e59b1a21]
<oprypin> no
<FromGitter> <ryanprior> so `.call()` is pretty much the only game in town then
<Groogy> yell
<Groogy> yepp*
DTZUZO has joined #crystal-lang
Groogy has quit [Ping timeout: 264 seconds]
zorp has quit [Ping timeout: 252 seconds]
zorp has joined #crystal-lang
Groogy has joined #crystal-lang
akaiiro has joined #crystal-lang
GoldenBear has quit [Ping timeout: 268 seconds]
GoldenBear has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
<Groogy> if I do a literal proc with ->, does return in that proc return the function or the proc?
gtramontina has joined #crystal-lang
gtramontina has quit [Ping timeout: 252 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]