<straight-shoota>
bah, that looks too much like actual science :D
<oprypin>
no this is actual science
<oprypin>
impurity removal is a good direction to dig in
rocx has quit [Ping timeout: 260 seconds]
<FromGitter>
<cbortz> Thanks for the response regarding the shards.yml spec @oprypin ! The link to the shards spec was tremendously helpful
_ht has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<jhass>
oprypin: mmh, yeah it seems a bit verbose to include verbatim. If the bot would keep an internal map of threads, say up to 100 and then rolling over, I could imagine at least a @#NN: kind of prefix though. But actually I'd even be thankful for a simple @thread: prefix or so, so I can at least ignore the messages knowing that my reply would be out of context and ignored
livcd has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
gangstacat has quit [Ping timeout: 272 seconds]
gangstacat has joined #crystal-lang
alexherbo2 has joined #crystal-lang
deavmi has quit [Read error: No route to host]
deavmi has joined #crystal-lang
deavmi has quit [Client Quit]
alexherbo2 has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Remote host closed the connection]
<FromGitter>
<xmonader> > @xmonader you would like to sort dates, you'll probably need to use `Time` ⏎ ⏎ yup indeed, I just want to get started just by just doing a compartor then map to Time
<oprypin>
so this might just be .sort!.reverse! if done simply
<FromGitter>
<xmonader> oh okayy my fault thought sort_by takes a comparator func
<FromGitter>
<xmonader> thank you
<oprypin>
but now that we have this consideration, you can `sort_by { |x| Time.parse(x) }`
<oprypin>
i have no idea how to actually parse time, that's a placeholder
<FromGitter>
<xmonader> i'll try it out thank you so much
<jhass>
fwiw you totally can do .sort {|x, y| y.a <=> x.a } to avoid a .reverse! after the fact
<jhass>
but yeah, don't try that with sort_by
<jhass>
also sort_by will be smarter about avoiding duplicate conversions
<FromGitter>
<xmonader> i'm worried with what to do in case of invalid dates to in the case of sort_by
<straight-shoota>
You don't necessarily need to parse as `Time`, but it's probably the easiest solution
<straight-shoota>
Alternatively, you can split the strings by `-` and sort the resulting array. This avoids the issue j8r mentioned
<straight-shoota>
How do you want invalid dates to sort?
<FromGitter>
<xmonader> probably want them to be the last
<jhass>
srsly we should run a short hash over the anchors...
<FromGitter>
<j8r> yep, or number overloads for each method
<FromGitter>
<j8r> must not be hard to do
<jhass>
well I'd prefer a stable hash, overloads may get some added/inserted/moved/removed etc
<jhass>
so I wouldn't depend on order of them
<FromGitter>
<confact> thanks jhass. It will hopefully work
<jhass>
compromise could be to keep the method name and only append the hash or even just run it over the arg list
<jhass>
then we could even add a second anchor to the first overload without the hash and just the bare name, in case somebody wants to guess-generate links
lunarkitty has quit [Ping timeout: 260 seconds]
lunarkitty has joined #crystal-lang
<straight-shoota>
stripping the names of positional arguments and default values would already help
<straight-shoota>
and the method type suffix could just be one letter
<straight-shoota>
maybe even a prefix
<jhass>
yeah, could just make class methods start with . or so
<jhass>
I think stripping argument name doesn't work though
<jhass>
could have foo(*, a : String) and foo(* c: String)
<FromGitter>
<Blacksmoke16> just skipping named/splat args?
<jhass>
sorry, what's the question related to?
<FromGitter>
<Blacksmoke16> i mean like arguments that dont have a type, or are a union of multiple types, or are special arguments, like named only, blocks, etc
<FromGitter>
<Blacksmoke16> since not all of them couldnt be represented just with a type class
teardown has quit [Read error: Connection reset by peer]
<jhass>
you lost me on the context of either sentence
<FromGitter>
<Blacksmoke16> was assuming `(String, Int32, Bool)` are just the types of the arguments
<jhass>
yes, I was just comparing straight-shoota's proposal to mine, ignoring the conflicts in his one
<jhass>
not sure where you're going...
<FromGitter>
<Blacksmoke16> nvm
<straight-shoota>
jhass foo(*, a : String) and foo(* c: String) are not positional arguments. I explicitly excluded that.
<straight-shoota>
But I agree a hash is probably easier to use
<FromGitter>
<Blacksmoke16> yes, with less changes required for future syntax/arguments changes
<straight-shoota>
Even if you want to build deep links from external sources. You need understand the specific anchor naming scheme anyway, so applying a proper hash shouldn't be a huge issue
<FromGitter>
<Blacksmoke16> assuming the hash would only change if the arguments change, be easy enough to just grab it from the docs
<straight-shoota>
Only downside: It's impossible to retrace the intent of such a hash when it's broken
<FromGitter>
<Blacksmoke16> ideally with some logic to take you to first method with that name, if it doesnt exist anymore?
<FromGitter>
<Blacksmoke16> well, could encode the docs version within the hash
<FromGitter>
<Blacksmoke16> or fallback on latest/master
<FromGitter>
<Blacksmoke16> if its not setup for that
<FromGitter>
<Blacksmoke16> er maybe the other way around. Default to latest/master, and fallback on the encoded version if it doesnt exist anymore
<FromGitter>
<Blacksmoke16> nvm, wouldnt really know the version it worked last on
<straight-shoota>
I can't see how hashing the version makes any sense at all
<straight-shoota>
How could links to latest possibly work if every release has different hashes?
<FromGitter>
<Blacksmoke16> usually overloads dont change the behavior, so wouldn't too bad
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
<jhass>
hence my proposal to just hash the arg list, skip the return type (it doesn't participate in overloading in any way) and append it to the method name
<jhass>
and have a prefix to the method name for class methods
<jhass>
I think that covers everything
<jhass>
the URL has still all the relevant info, type and method name
<jhass>
anybody that says they recognize two different overloads from the current URLs I don't believe
<FromGitter>
<Blacksmoke16> ^
<jhass>
hence I'd even argue a hash might improve URL readability, easier to see it differs between two overloads
<jhass>
(a short hash)
Human_G33k has quit [Ping timeout: 246 seconds]
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
hightower3 has joined #crystal-lang
<hightower3>
Hey oprypin fixed the `uname -s` thing in bindgen. If you still have the checkout ready and could run it again to possibly report another error that'd show up in windows platform, that'd be great.
<FromGitter>
<Blacksmoke16> for quick modeling stuff
<raz>
yeh, there's a bunch of tools in that vein
<raz>
anyway, what's really missing is an ORM that just automatically reflects on the db
<raz>
and proper diffing (no migrations)
<raz>
almost 50 years of RDBMS history and we still manage schemas / orm mappings like in the stone age
<hightower3>
there's also pgModeler
<raz>
yeh, but that's all sticks & stones
<raz>
feels like writing an book given only a casio watch interface with 4 buttons and a blinking 00:00
<hightower3>
in Ruby there's minirecord .. Still not at final level of sophistication, but at least in that direction
<hightower3>
or mini_record rather
<raz>
yeh there's many half-hearted attempts in that direction. but nothing serious.
<raz>
sqlalchemy also has auto-migrations to a degree, etc. but that's not even half of the story
<raz>
frameworks should ship with a GUI like what blacksmoke posted. not only to create an initial SQL snippet, but also to modify the db later. where modifications automatically generate the diff-migration to be shipped around and applied later. and all model files should be optional, with a basic auto-generated crud interface being the default.
<raz>
but nobody pays for the year(s) of development to finish such a thing. so we keep our sticks & stones. and sometimes paint them a different color and pretend that's progress.
<raz>
...and everyone builds the same basic CRUD screens, form validations, signup process, etc. over and over. for every app. only to eventually apply a slightly different stylesheet to it than for the previous app. an endless cycle of job security.
<FromGitter>
<kinxer> @Blacksmoke16 I don't think it's pertinent to the thread, but I don't think `#&//` usually makes sense. People will almost always be using `Int#//(other : Int)`, which will never overflow. `#//` could overflow for a Float argument, but I feel like you'd almost always want the exception in that case.
<FromGitter>
<Blacksmoke16> been waiting *ages* of `0.35.0` :p
<FromGitter>
<Blacksmoke16> for*
<FromGitter>
<kinxer> Yeah. I'm trying to figure out how to use Valgrind with a Crystal executable (as someone with limited experience with Valgrind), and my main issue right now is that callgrind seems to have access to only the locations of functions, not their names...
<FromGitter>
<kinxer> Looking through that thread, I can't see anything to indicate that the debugger stuff will definitely fix that, but it might.
<FromGitter>
<Blacksmoke16> try against master?
<FromGitter>
<kinxer> I usually use an RPM distribution of Crystal... Is the easiest way to do that with Docker, or should I clone the compiler and build it?
<FromGitter>
<kinxer> That is, the easiest way to use master.
<FromGitter>
<Blacksmoke16> well you could use the nightly docker image
<FromGitter>
<Blacksmoke16> hop in the container with bash shell/volume?
<FromGitter>
<kinxer> I'm also relatively unpracticed with Docker... Would that be `docker pull crystallang/crystal:nightly`?
<FromGitter>
<kinxer> And then create a container with that image and run it with a bash shell and mount point?
<FromGitter>
<Blacksmoke16> mm try like `docker run -it crystallang/crystal:nightly bash`
<FromGitter>
<Blacksmoke16> optionally could add a `-v $PWD:/app -w /app` if you wanted to use an external edit and then run it within the container
<FromGitter>
<Blacksmoke16> but probably not much more helpful than just `if obj.truthy?`
<FromGitter>
<Blacksmoke16> and would be quite confusing to debug like `if obj || other_obj`
kradnoel has joined #crystal-lang
kradnoel has quit [Read error: Connection reset by peer]
<FromGitter>
<kinxer> Ah... I've been using `--release`, and that stripped the names from things.
<FromGitter>
<kinxer> It works without it, but I feel like I can't entirely trust the profiling if I can't use `--release` with it...
<FromGitter>
<Blacksmoke16> try adding `--debug`
HumanG33k has quit [Ping timeout: 265 seconds]
<FromGitter>
<kinxer> I was using `--release --debug`. I'm seeing if switching the order makes any difference.
<FromGitter>
<kinxer> Also, interesting, I'm timing two different prime generators (simple ones), and on is consistently faster with just `--release` (about 10% faster) but is about 50% as fast when using `--debug` (even with `--release`).
zorp_ has joined #crystal-lang
zorp has quit [Ping timeout: 265 seconds]
_ht has quit [Remote host closed the connection]
<FromGitter>
<kinxer> The method that's faster with just `--release` uses about 3 times as many array accesses (41 million vs 13 million), but no calls to `Math.sqrt` (which the other method calls about 13 million times). It's interesting to me that the array accesses are able to be optimized somehow much more than the square root call.
<raz>
Blacksmoke16: i hate code that relies on truthiness. explicit .nil? ftw.
<raz>
these `if foo` checks are all fun and games. until a boolean enters the picture.
postmodern has joined #crystal-lang
<FromGitter>
<Blacksmoke16> pretty much yea
<raz>
less of an issue in crystal admittedly (nil usually needs extra care anyway). but in ruby i see those "tri-state" booleans blow up fairly regularly.
<FromGitter>
<kinxer> Re profiling, it turns out I have to compile the executable statically to get the method names.
<FromGitter>
<kinxer> Or, well, that's what I suspect. I had to compile it statically anyway just to run it through valgrind on my host machine after compiling in the docker container, and no combination of `--release` and `--debug` seems to work when compiling on my host machine with `0.34.0`.
<FromGitter>
<kinxer> So short of cloning the compiler and building it myself, I don't really have a good way of knowing if it's the newer compiler or the static compilation until `0.35.0` rolls out.
<FromGitter>
<Blacksmoke16> cant use docker?
<FromGitter>
<Blacksmoke16> can use the nightly alpine image to build it statically there
<FromGitter>
<kinxer> I mean, the static compilation works with the nightly container. What I was saying was that in order to compile in the container and run the executable on my host (through valgrind) I needed to statically compile on the docker container, which means that I can't necessarily tell whether I was getting function names from the static compilation or the newer compiler.
<FromGitter>
<kinxer> I'm gonna try installing valgrind on the container and running it there.
<FromGitter>
<Blacksmoke16> ah gotcha
<FromGitter>
<Blacksmoke16> and yea, would have to build the compiler locally
<FromGitter>
<kinxer> Okay, so after running valgrind on the container, it looks like it's the compiler emitting names and stuff. So profiling with callgrind should work in 0.35.0. I'll probably reply to that thread to that effect.
<FromGitter>
<kinxer> And it works with `--release`.