<FromGitter>
<Blacksmoke16> alpine one is 70mb, the other is 300
<FromGitter>
<mwlang> ok, only one image remains running after that.
<FromGitter>
<Blacksmoke16> the db?
<FromGitter>
<mwlang> yup
<FromGitter>
<Blacksmoke16> same exec error?
<FromGitter>
<mwlang> yup
<FromGitter>
<Blacksmoke16> interesting
<FromGitter>
<mwlang> still same "No address found for db:5432
<FromGitter>
<Blacksmoke16> im pretty sure thats ok
<FromGitter>
<Blacksmoke16> let me try something
<FromGitter>
<mwlang> how so? (Socket::Addrinfo::Error)
<FromGitter>
<mwlang> means its not resolving "db" to an ip address, right?
<FromGitter>
<Blacksmoke16> but if you're in a bash session in the container that doesnt really mean much
<FromGitter>
<Blacksmoke16> as `db` doesnt mean anything in that context
<FromGitter>
<Blacksmoke16> would have to use the ip of the db container
sorcus has quit [Ping timeout: 276 seconds]
<FromGitter>
<mwlang> ok, just noticed something in the database.cr that was probably the problem...it's constructing a database name from environment.database_name = "maestro_#{Lucky::Env.name}"
<FromGitter>
<mwlang> (I should read the code more closely!)
<FromGitter>
<mwlang> thanks for explaining context of "db" -- I didn't realize in bash shell of the docker image that it was expected that doesn't resolve.
<FromGitter>
<Blacksmoke16> its used by the docker network to resolve them using magic yea
<FromGitter>
<Blacksmoke16> but within a container you my as well be typing int foo.com:5432
<FromGitter>
<Blacksmoke16> as remember a container is just a vm basically
<FromGitter>
<mwlang> same error.
<FromGitter>
<Blacksmoke16> exec error?
<FromGitter>
<Blacksmoke16> are you on mac?
<FromGitter>
<mwlang> yes
<FromGitter>
<mwlang> yes
<FromGitter>
<mwlang> docker 2.0.0.3 if that matters
<FromGitter>
<Blacksmoke16> try this
<FromGitter>
<Blacksmoke16> start a new project with a hello world app and see if you can get that working
<FromGitter>
<Blacksmoke16> did removing them fix?
<FromGitter>
<Blacksmoke16> it should if my theory is correct
<FromGitter>
<mwlang> nope.
<FromGitter>
<Blacksmoke16> really
<FromGitter>
<Blacksmoke16> same file not found error?
<FromGitter>
<mwlang> or maybe I broke something else...one more try.
<FromGitter>
<Blacksmoke16> `docker-compose up --buidl`
<FromGitter>
<mwlang> I took out /app/bin in front of "maestro" on both the crystal run and the CMD --- added it back and now trying again with full paths and no volumes.
<FromGitter>
<Blacksmoke16> since the images are prob going to be diff for dev and prod
<FromGitter>
<mwlang> oh, nice.
<FromGitter>
<mwlang> I'm going to have to deep dive into docker one weekend and really get to know it's ins and outs.
<FromGitter>
<Blacksmoke16> gl
<FromGitter>
<Blacksmoke16> too much to discover :P
<FromGitter>
<mwlang> thanks for your help tonight. You really got me over a big block there.
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<Blacksmoke16> not making a JSON api are you? :P
<FromGitter>
<mwlang> not any more!
<FromGitter>
<mwlang> I'm putting it to work
<FromGitter>
<mwlang> :-D
<FromGitter>
<mwlang> I may start a BitMEX one next.
<FromGitter>
<Blacksmoke16> was going to say if so, coughshouldhavetriedathenacough
<FromGitter>
<mwlang> I can give it a go. I looked at it a bit while trying to learn crystal initially. Just trying out Lucky for a this experiment mostly.
<FromGitter>
<mwlang> but planning to experiment with Athena next. Already played around with Amber.
<FromGitter>
<Blacksmoke16> 👍 is pretty slick, but deff not as mature as amber/lucky
<FromGitter>
<Blacksmoke16> lot of stuff is left up to you
<FromGitter>
<mwlang> hmm...the app image never launches.
<FromGitter>
<Blacksmoke16> it shouldnt depend on migrator
<FromGitter>
<Blacksmoke16> since migrator wont ever be up for more than a few while it does the migrations
<FromGitter>
<mwlang> oh, I thought you said that's what I needed to do to ensure migrator runs and completes before the app runs.
<FromGitter>
<Blacksmoke16> ah no, it shouldnt matter
<FromGitter>
<Blacksmoke16> just that db is up before the app
<FromGitter>
<Blacksmoke16> the migrations can happen even if the app is running
<FromGitter>
<Blacksmoke16> as its just running sql against the db, doesnt really have anything to do with the app
<FromGitter>
<mwlang> but then the app crashes right off the bat when it starts with ```app_1 | Unhandled exception: relation "migrations" does not exist (PQ::PQError)```
<FromGitter>
<mwlang> maybe it doesn't matter *after* the first migration to set things up...
<FromGitter>
<Blacksmoke16> yea
<FromGitter>
<Blacksmoke16> plus does `lucky watch` reload the code for you?
<FromGitter>
<Blacksmoke16> on save or something
<FromGitter>
<mwlang> if I use lucky, yes.
<FromGitter>
<mwlang> but I'm compiling to get "maestro" app and that's what I'm running.
<FromGitter>
<mwlang> I mean, I couldn't find *any* documentation on deploying, but intuitively, it seemed that I just needed to compile the main app and run it.
<FromGitter>
<Blacksmoke16> pretty much
<FromGitter>
<mwlang> something's still wrong...even removing "depends_on" migrator, the app's never launching.
<FromGitter>
<mwlang> It still has depends on db
<FromGitter>
<Blacksmoke16> hmm
<FromGitter>
<mwlang> whacked...commented out the migrator and it's not launching. :-/
<FromGitter>
<girng> "but if you’re writing uber long functions then you’re a terrible programmer.", nice. way to hit me when i'm down
<oprypin>
girng, hey nobody ever backed up that claim about long functions, so maybe you'll be fine
<Yxhuvud>
I remember back to a former workplace, that had a 4000 lines long for statement, in for levels deep of nested switches and if statements. That was a challenge to maintain.
ht_ has joined #crystal-lang
<FromGitter>
<drum445> I use guard clauses, but I think a function only doing one thing is more important than line count
mps has quit [Ping timeout: 245 seconds]
mps has joined #crystal-lang
_whitelogger has joined #crystal-lang
absolutejam4 has joined #crystal-lang
sorcus has joined #crystal-lang
ua_ has quit [Ping timeout: 245 seconds]
<FromGitter>
<Blacksmoke16> they help with more than line count
<FromGitter>
<Blacksmoke16> makes it way way more readable
<FromGitter>
<Blacksmoke16> im not a big fan of long functions myself, but sometimes you cant avoid it (look at the the lexer in compiler)
<FromGitter>
<Blacksmoke16> are things you can do help fight it, for example if you have a chunk of logic in a big function that is doing some task, just to get a single value or something, could probably pull that section of code out into a private method then the could would be like
<FromGitter>
<Blacksmoke16> which can help, also makes that method reusable if you need to do the same logic multiple times
absolutejam4 has quit [Ping timeout: 258 seconds]
ua has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
absolutejam4 has joined #crystal-lang
<FromGitter>
<mwlang> true story...I once worked on a project that had only *one* function in the entire app and couldn't convince the owner to break functionality out into multiple functions/methods. This was back in Windows 95 days and using Delphi. One day, that function got so big, it could no longer compile and fit into 64KB, which was the maximum amount of space a single routine could fit.
laaron has quit [Remote host closed the connection]
<FromGitter>
<mwlang> The owner still wouldn't change his ways when we got to that point so I left the company figuring it a lost cause to continue to struggle with such a constraint needlessly.
<FromGitter>
<j8r> @mwlang good one, wow 😮
<FromGitter>
<j8r> he was duplicating code inside it, I suppose?
<FromGitter>
<mwlang> It was a gigantic nested mess of if/else statements
laaron has joined #crystal-lang
<FromGitter>
<mwlang> it's kinda sad when I reflect on it. Owner was a great guy. three of us came onboard the same week from another contract we were all let go from. He gave us a set of new features to build and the three of us tackled it together and immediately started unraveling that monolithic function into many. A week later when we had the code review, the owner was infuriated and made us roll it all back into the one
<FromGitter>
... function with no calls out (other than obviously to the standard library methods).
<FromGitter>
<mwlang> we couldn't convince him over the course of four months or so that our way was ultimately better.
<FromGitter>
<mwlang> and then when the thing stopped compiling and loading successfully, it took us a week of debugging to realize we'd grown beyond the 64kb barrier.
<FromGitter>
<mwlang> what makes it sad is that the owner was one of the nicest and smartest guys I've met so you'd think when three sharp developers tell him one function is just bad, he'd listen, but I think hindsight, what probably was stopping him was he felt he was paying us to rewrite already existing and working code instead of for altogether new features and he just flat out didn't want to pay for that (in addition to just
<FromGitter>
... being caught in a "I know this, I don't want to change" fear trap.
<FromGitter>
<Blacksmoke16> oh well
absolutejam4 has quit [Ping timeout: 248 seconds]
<FromGitter>
<Blacksmoke16> btw, you should prob reenable your volume
<FromGitter>
<mwlang> Question about what goes into git repo: Ruby projects, if a gem project do not commit Gemfile.lock, but Rails projects generally do. Reasoning is we don't want to lock down gems for consumers of those gems, but we provide guidelines for what minimum versions of each dependency will work. With Rails apps, on the other hand, we do want to lock down specific gem versions so dev environment matches production
<FromGitter>
... environment as closely as possible. Is the same reasoning applicable to when to commit shard.lock or gitignore it?
<FromGitter>
<Blacksmoke16> i think thats the diff between `crystal init app/lib`
<FromGitter>
<mwlang> oh, yeah. thanks for that reminder. I'm actually reading up on docker now.
<FromGitter>
<Blacksmoke16> an app would be a consumer of the shards which could depend on specific versions
<FromGitter>
<Blacksmoke16> but libraries dont need to be locked as they'll be locked by the applications that use them
<FromGitter>
<mwlang> so for crystal apps, generally speaking, commit the lock file and for shards, do not. right?
<FromGitter>
<Blacksmoke16> id imagine its a big switch
<FromGitter>
<Blacksmoke16> in how you go about doing things
<FromGitter>
<Blacksmoke16> heres a question
<FromGitter>
<j8r> but you can restrict versions on `shard.yml`
<FromGitter>
<j8r> the lockfiles are mainly used for reproducible builds
<FromGitter>
<j8r> and libraries don't have builds, no point of lockfiles
<FromGitter>
<Blacksmoke16> the DB shard has a method ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Im trying to wrap that method so you can do like `MyModel.transaction do |tx|` vs having to do like `MoModel.adapter.database.transaction do |tx|` but i dont really know what im doing [https://gitter.im/crystal-lang/crystal?at=5d20a5cdc74a8b447f7d572d]
<FromGitter>
<Blacksmoke16> im sure theres a way to do it...
waheedi has joined #crystal-lang
<waheedi>
sup folks, I have an issue trying to make require works properly with a built from source installation
<waheedi>
osx10.12
<FromGitter>
<Blacksmoke16> whats the error?
<waheedi>
its unable to find the lib "shard_name"
<waheedi>
require "minitest" can't find the file
<FromGitter>
<Blacksmoke16> did you do a shards install?
<waheedi>
yes
<waheedi>
and the shards.lock is there and the lib folder is tehre
<waheedi>
there*
<waheedi>
on what basis does require look for the library inside the lib folder?
<FromGitter>
<Blacksmoke16> and you're just doing `require "minitest"`?
<FromGitter>
<Blacksmoke16> thats all you should need to do
<waheedi>
minutest is required and all is good guys
<waheedi>
the thing is that crystal run/build complain about not finding the require shard
<waheedi>
my question again, one what basis does the require look in the lib folder inside the project directory?
<FromGitter>
... somehow)
<FromGitter>
<mwlang> when using docker for development and running deployed apps, what's the easiest way to have the Dockerfile or compose file "choose" the environment to build? For example, development, test, staging, or production? I realize I can set an ENV variable in the file, but that hard codes it and I'm thinking it needs to change according to where the containers are built somehow and consistently (meaning automated
<FromGitter>
<Blacksmoke16> but my understanding it just looks for the lib that has the same name as you're typing based on the `name` key in the shard's shard.yaml
<FromGitter>
<Blacksmoke16> use a common yaml file and have a method that returns the corresponding env object from the yaml file based on the environment
<FromGitter>
<Blacksmoke16> also would allow using yaml merge feature to share common settings between envs
laaron has quit [Remote host closed the connection]
<FromGitter>
<mwlang> yeah, env_file is what I needed. thanks!
<waheedi>
well, it seems the docs are a little bit unclear here ttps://crystal-lang.org/reference/syntax_and_semantics/requiring_files.html
<waheedi>
when i do shards install
<FromGitter>
<mwlang> @Blacksmoke16 can you use a macro on the model's class level to basically emit that block of code?
<waheedi>
it installs the needs shards, but their structure is different from what expected, for example right now the structure is cr_project/lib/minitest/src/minitest.cr and not cr_project/lib/minitest/minitest.cr as the documentation say
<FromGitter>
<Blacksmoke16> pretty sure its based on the shard name
<FromGitter>
<Blacksmoke16> prob wouldnt be too hard to add npm
waheedi has quit [Quit: waheedi]
ht_ has joined #crystal-lang
mps has quit [Ping timeout: 245 seconds]
<FromGitter>
<Blacksmoke16> node*
snsei_ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
<FromGitter>
<mwlang> kinda hard because I can't install curl. I'm assuming (but haven't verified) that a bunch of the package manager stuff was removed to reduce footprint.
<FromGitter>
<mwlang> because apt-get install curl just says package not found.
<oprypin>
mwlang, search for it. likely 'libcurl'
<FromGitter>
<mwlang> to install yarn, I cheated by checking in the PGP key into the repo and just copying it over instead of using curl, but that's not really a good security practice.
<oprypin>
could even have some version number as part of pkg name
<FromGitter>
<mwlang> but then again, I am not at all sure crystallang::crystal image is based on Ubuntu or some ultra pared down debian image.
<FromGitter>
<mwlang> since I'm learning docker more or less from the ground up, might as well learn how to build my own images so I do know what's in 'em. :-)
<FromGitter>
<Blacksmoke16> Sounds like a plan
<FromGitter>
<mwlang> I'm esp. curious about these multi-stage builds -- really awesome idea/feature.
<FromGitter>
<Blacksmoke16> Mostly useful for prod builds
<FromGitter>
<Blacksmoke16> Like build your js in one, then just copy the built files into nginx
<FromGitter>
<tenebrousedge> pgp key sounds like an ENV var
<FromGitter>
<mwlang> well, really, it needs to come from the source always since it's used to check signature of the debian package being installed.
<FromGitter>
<mwlang> I was just forcing my way through a first time docker deploy/build and wanted to keep moving along.
<waheedi>
would someone help me out with crystal env output?
<waheedi>
for some reason I can see it trying to require some none sense path "/Users/Waheedi/projects/crystal/src/lib_c/x86_64-darwin/minitest/src/minitest/autorun/autorun.cr"
<waheedi>
it seems this env var is related somehow
<FromGitter>
<Blacksmoke16> pretty sure thats used for linking c libs
<FromGitter>
<Blacksmoke16> `The compiler uses the CRYSTAL_LIBRARY_PATH environment variable as a first lookup destination for static and dynamic libraries that are to be linked. This can be used to provide static versions of libraries that are also available as dynamic libraries.`
<FromGitter>
<Blacksmoke16> you still having trouble requiring minitest?
<waheedi>
a problem requiring any shard
<waheedi>
minutest is just an example
<waheedi>
minitest*
<FromGitter>
<Blacksmoke16> have some code to share?
<waheedi>
why its looking for minitest there it should be looking in Dir.current + "lib/" + "minitest/src/minitest/autorun/autorun.cr"
<FromGitter>
<cfsamson> Ha. Ok, so STDOUT is probably linking to some library then since that code didn't do much :)
<FromGitter>
<cfsamson> Ok, interesting. Thanks
<FromGitter>
<Blacksmoke16> stdout is just an IO `IO::FileDescriptor.from_stdio(1)`
<FromGitter>
<dscottboggs_gitlab> Is there a way to make a reference type immutable, or to take a deep copy of a refence's value?
<FromGitter>
<cfsamson> I see. Well somehow there is a lock on stdout when compiling for windows that doesn't seem to be released, so somwhere in the source there must be a conditional compilation for `stdout` on different arcitectures? It does work on Linux...
<FromGitter>
<Blacksmoke16> hmm, let me try upgrading to new shards version
<waheedi>
Thanks @Blacksmoke16
<FromGitter>
<Blacksmoke16> what happens if you did like `rm -rf ~/.cache/shards/ ~/.cache/crystal/ shard.lock lib/`
<FromGitter>
<Blacksmoke16> then try to install and run again
<FromGitter>
<Blacksmoke16> :shrug:
<waheedi>
same
<waheedi>
the "lib/" is missing
<FromGitter>
<dscottboggs_gitlab> It looks like I'm going to have to define a custom `#clone`
<waheedi>
Something should be adding the "lib/" path but i can't find it if it exists?
<FromGitter>
<dscottboggs_gitlab> oh, no there's a macro `def_clone` that's nice :)
<FromGitter>
<Blacksmoke16> indeed :)
<FromGitter>
<Blacksmoke16> let me try on my mac i guess
<FromGitter>
<asterite> whaeedi: what's the output of `crystal env`, in particular CRYSTAL_PATH ?
oprypin has quit [Quit: No Ping reply in 180 seconds.]
oprypin has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @dscottboggs_gitlab could you not use a record?
<FromGitter>
<dscottboggs_gitlab> I don't mean a reference to an immutable type, I mean an immutable reference to a mutable type
<FromGitter>
<dscottboggs_gitlab> Like an actual constant
<FromGitter>
<Blacksmoke16> oh like `FOO = [1,2,3]` to make sure the values dont get changes or more values pushed/removed?
<FromGitter>
<dscottboggs_gitlab> exactly
<FromGitter>
<Blacksmoke16> we were just talking about this the other day
<FromGitter>
<Blacksmoke16> ruby has the `freeze` method
<FromGitter>
<dscottboggs_gitlab> Like i get the rationale for what we have, i just wish there was a way to do the other thing too
absolutejam4 has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> I'm having to use `#clone` which is not the most efficient. It's just tests so it's not a huge deal but in general taking a deep copy just to avoid changing a constant seems a little...wrong?
<FromGitter>
<dscottboggs_gitlab> hm, maybe this could be implemented as a library using macros and annotations...
<FromGitter>
<Blacksmoke16> maybe worth a forum post
<waheedi>
so basically the only thing thats missing is the :lib directive in the env variable
<waheedi>
CRYSTAL_PATH is used to look up the shards inside lib in that way
<waheedi>
it basically do a lookup on all values in CRYSTAL_PATH
<waheedi>
that's where the "lib/" comes from :)
<waheedi>
so I can just use the built crystal bin directly :)
<FromGitter>
<Blacksmoke16> sounds right
<FromGitter>
<Blacksmoke16> @dscottboggs_gitlab prob would be doable somehow
<FromGitter>
<dscottboggs_gitlab> I'll take a look into it if I remember/have time this week
<FromGitter>
<dscottboggs_gitlab> making a forum post about it
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> maybe something with the visitor methods
<FromGitter>
<Blacksmoke16> on assign check if the instance is "readonly" and raise if so, i.e.
<absolutejam4>
I meant is it the same for methods, but that's `def foo : ReturnType`
<absolutejam4>
and I'd not seen many examples of explicit return type. Guess the compiler is just that good
<absolutejam4>
thanks dscoottboggs_gitlab
gangstacat has quit [Ping timeout: 252 seconds]
<absolutejam4>
I feel `: String ->` is a bit ambiguous
<FromGitter>
<Blacksmoke16> its unique to blocks `&block : YieldType -> ReturnType`
<FromGitter>
<Blacksmoke16> `: String -> _` would be a bit more clear
<absolutejam4>
yeah
<FromGitter>
<Blacksmoke16> i mean thats a thing you can do, just wasnt in this case i guess
<FromGitter>
<mwlang> Is it normal for ```docker-compose up``` to sit around for 2 to 5 minutes on Digital Ocean VPS with 0% CPU utilization?
<FromGitter>
<mwlang> before the first command ever starts executing?
<FromGitter>
<Blacksmoke16> prob not
<FromGitter>
<mwlang> you, know...I think I had this sort of extreme lagging issue last time I tried to start a VPS in the SFO datacenter.
<FromGitter>
<mwlang> gonna flip it over to NYC
<FromGitter>
<Blacksmoke16> well could it just take that long to build the images?
<FromGitter>
<Blacksmoke16> since the wouldnt be there already/already built
<FromGitter>
<mwlang> it might take that long to build an image, but I should see step 1, step 2, etc. as it goes.
<absolutejam4>
oh, that's clearer at least Blacksmoke16, thanks
<FromGitter>
<mwlang> and besides... 0% CPU the whole time.
<FromGitter>
<mwlang> almost like a DNS resolution time out issue rather than a VPS issue.
<FromGitter>
<Blacksmoke16> yea doing that would make `yield "foo"` work, but `yield 123` would raise a compile error
<FromGitter>
<Blacksmoke16> yea dunno
<FromGitter>
<j8r> @dscottboggs_gitlab what about `#dup`?
<FromGitter>
<dscottboggs_gitlab> #dup is only a shallow copy. In the case of a reference type, that creates a new pointer which points to the same area of memory
<FromGitter>
<Blacksmoke16> could also use your own images in other images
<FromGitter>
<Blacksmoke16> like at work we have a base image that has the OS/common things, then other images just use that and add specific things depending on what they are going to be used for
<FromGitter>
<j8r> no from scratch @Blacksmoke16 ?
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<j8r> the best would be to build statically the binary on Alpine, then put it in a `from scratch` image (multi stage build)
<FromGitter>
<Blacksmoke16> oh sorry i just meant in general using docker, not specific to crystal
<FromGitter>
<Blacksmoke16> i tried that using your image but got some `"/bin/sh"` error
<FromGitter>
<j8r> what I said can be also done in general too
<FromGitter>
<j8r> `/bin/sh` errors?
<FromGitter>
<Blacksmoke16> ill see if i can reproduce
<FromGitter>
<j8r> keep it mind the interpreter isn't bash
<FromGitter>
<Blacksmoke16> that was prob it
absolutejam1 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.5]
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
alex`` has quit [Ping timeout: 246 seconds]
snsei__ has joined #crystal-lang
alex`` has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
jrayhawk has quit [Ping timeout: 244 seconds]
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
jrayhawk has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> made this a little while ago but made it a bit better
<FromGitter>
<Blacksmoke16> usage is say you have a record you are POSTing, can add this annotation to a field/property and assert the id supplied in the post body actually exists
<FromGitter>
<Blacksmoke16> still using FKs in the database, but this way there is no code that has to check this in the controller code as it all happens on deserialization
<FromGitter>
<mwlang> very nice.
ht_ has quit [Remote host closed the connection]
<FromGitter>
<girng> only reason i'm for guard clauses is because of what blacksmoke did to my code yesterday lol. literally transformed it into a way more readable version
<FromGitter>
<girng> that's.. a good reason too
<FromGitter>
<girng> they also let the local variable be accessed underneath the clause which is amazing. i always thought local variables were bound to their block / inside if statement
<FromGitter>
<alexherbo2> @mwlang Thanks you very much for you ws Gist
<FromGitter>
<alexherbo2> and Crystal patterns
<FromGitter>
<j8r> @dscottboggs_gitlab what about making `Fixtures` a struct?
<FromGitter>
<j8r> (And `CONFIG` a getter)
<FromGitter>
<dscottboggs_gitlab> `users` is an `Array(User)` which is a mutable reference type
<FromGitter>
<dscottboggs_gitlab> obviously, one needs to copy the original memory referenced by the `CONFIG` value, but that, and the enforcement that it must not be mutated, should both be enforceable at compile time IMO
<FromGitter>
<dscottboggs_gitlab> all of this is possible via macros though (I think)
<FromGitter>
<dscottboggs_gitlab> although I'm probably wrong because @asterite says otherwise and he's usually right compared to me 😆
snsei__ has joined #crystal-lang
<FromGitter>
<j8r> The constant would become a getter
<FromGitter>
<j8r> That was we would like: a new `Fixtures` instance per spec
<alex``>
is it possible for getter to have a type?
<FromGitter>
<dscottboggs_gitlab> That was my solution -- recursively `def_clone` on all types under `Config` so that it can be `#clone`d before every spec. However, the compiler should have been *capable* of at least warning me that I was about to mutate a value which is expected to be constant, if not totally fail compilation with a helpful stack trace
<alex``>
don’t found this line right
<FromGitter>
<dscottboggs_gitlab> alex, what?
<FromGitter>
<dscottboggs_gitlab> OH! I see
<alex``>
would be a way in the module definition to set `observers` to `[] of Observer`
<FromGitter>
<dscottboggs_gitlab> that's how I would do it
<FromGitter>
<alexherbo2> `T` here represent `Observer` or `Fighter`?
<FromGitter>
<alexherbo2> I don’t get why `(T)` is for
<FromGitter>
<alexherbo2> @dscottboggs_gitlab why it’s not `getter observers : Array(Observer)`
<FromGitter>
<dscottboggs_gitlab> ok so...it looks like cone would make a class which is independent of this library which inherits from `Observer`. This type must implement `#update(fighter)`, whatever `fighter` is ¯\_(ツ)_/¯
<FromGitter>
<dscottboggs_gitlab> yep it probably should be @alexherbo2
<FromGitter>
<dscottboggs_gitlab> Also, `Observer` could be an interface/module
<FromGitter>
<alexherbo2> `T` has a special meaning?
laaron- has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> T is the conventional use for a generic tpye
laaron has quit [Remote host closed the connection]
<FromGitter>
<dscottboggs_gitlab> like `Array(T)`
<FromGitter>
<alexherbo2> `getter observers : Array(T) { [] of T }`, `{ [] of T }` is necessary?
<FromGitter>
<alexherbo2> or I can drop it
<FromGitter>
<dscottboggs_gitlab> so... that's a language feature which I really like but I'm not sure is a great Idea
<FromGitter>
<alexherbo2> never used `{ ... }` part, I assume it’s for initializing the values
<FromGitter>
<dscottboggs_gitlab> `property`, `getter`, and `setter` accept an optional block which lazily instantiates a default value
<FromGitter>
<dscottboggs_gitlab> one can also eagerly instantiate a default value like `getter observers = [] of Observer`
<FromGitter>
<Blacksmoke16> dont know enough about the type sys
moei has quit [Quit: Leaving...]
<FromGitter>
<dscottboggs_gitlab> 🤞 here's hoping it's possible
<FromGitter>
<dscottboggs_gitlab> shit crossed fingers emoji doesn't work in gitte
<FromGitter>
<dscottboggs_gitlab> l;ame
<FromGitter>
<Blacksmoke16> hm? i see it quite fine
absolutejam1 has quit [Ping timeout: 245 seconds]
waheedi has quit [Quit: waheedi]
<FromGitter>
<girng> works here too
<FromGitter>
<girng> 🤞🤞🤞🤞🤞🤞🤞🤞🤞🤞🤞🤞
<FromGitter>
<Blacksmoke16> naw i see boxes
<FromGitter>
<Blacksmoke16> on my desktop at least
<FromGitter>
<girng> i thought you said you see it just fine
<FromGitter>
<girng> now, boxes?
<FromGitter>
<girng> what's going on
<FromGitter>
<Blacksmoke16> phone was fine, desktop boxes
<FromGitter>
<girng> you post on gitter on your phone?
<FromGitter>
<girng> i'm on desktop, and see them
<FromGitter>
<Blacksmoke16> when im lazy sitting on the couch its easier than getting up :P
<FromGitter>
<Blacksmoke16> prob dont have fonts installed or something
<FromGitter>
<girng> lol true dat
<FromGitter>
<girng> i just ahte typing on the phone
<FromGitter>
<girng> my thumbs are too fat
<FromGitter>
<girng> and fingers
<FromGitter>
<Blacksmoke16> if its more than a few words then ill get it
<FromGitter>
<girng> anyways, i hate emojis
<FromGitter>
<girng> i only liked text based ones
<FromGitter>
<girng> there are so many variations of emojis, trying to have the same 1 for all devices is insane and not possible
<FromGitter>
<girng> and might distort the emotion expressed by the user
<FromGitter>
<girng> unless the emojis are used specific for a site (bbcode to emoji parser), then it's fine. but emojis from ASCII that are converted on the browser are cancer