<FromGitter>
<watzon> Trying to subclass and redeclare a variable as a different type
<FromGitter>
<Blacksmoke16> dont declare it in the parent?
<FromGitter>
<watzon> It's needed in the parent though
<FromGitter>
<watzon> I guess I'd have to make a parent for the parent huh
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<watzon> Fml haha
<FromGitter>
<watzon> Just hacked around it for now by making a `@_default` variable in the child class, but I don't like it
<FromGitter>
<watzon> I'll figure out something later
<FromGitter>
<Blacksmoke16> :this_is_fine:
deavmi has quit [Ping timeout: 264 seconds]
deavmi has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 2.7]
<FromGitter>
<watzon> Does Crystal have trouble resolving requires with a hyphen? Like `require "term-cursor"`.
<FromGitter>
<watzon> It was working when it was just cursor, but adding the hyphen seems to have broken things. It's updated in both `shard.yml` files.
<FromGitter>
<Blacksmoke16> It shouldn't
<FromGitter>
<Blacksmoke16> Try deleting lib and reinstall?
<FromGitter>
<watzon> Already tried
<FromGitter>
<watzon> Hmm
<FromGitter>
<watzon> Does directory structure matter in this case? Changing it back to `cursor` made it work again, so I'm thinking maybe I need a `src/term/cursor` structure?
<FromGitter>
<Blacksmoke16> Or q file with the hyphen
<FromGitter>
<watzon> Ahhh yeah, that would probably do it
<FromGitter>
<watzon> Duh
<FromGitter>
<watzon> Yep that's it
<FromGitter>
<Blacksmoke16> Mhm
blueberrypie7 has quit [Quit: leaving]
blueberrypie has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter>
<damianham> > *<raz>* john carmack says it's ok, so it's ok β β But it isn't though. As software engineers if we review the code we can see instantly that it isn't OK. The problem is not that this code isn't OK. The problem is that this code is being used to drive government policy decisions that affect the lives of millions of people and without decent test coverage they cannot prove the code is OK. The
<FromGitter>
... cancelling of cancer treatment in hospitals will cause some people with cancer to die due to lack of treatment. That has happened because of this prediction model. If we cannot prove that this model performs correctly then how can we trust it to accurately predict pandemic outcomes. Furthermore this team at IC has been spectacular ... [https://gitter.im/crystal-lang/crystal?at=5eb6342e7975db7ebff3a87a]
zorp has joined #crystal-lang
<FromGitter>
<watzon> The problem is that very few people have the requisite knowledge about the subject in order to successfully write something better than what's already there. Think about it, whoever wrote that code likely at least knew what they were doing to some degree when it comes to modeling the spread of a virus, and they still managed to fuck it up. As cool as it would be to use Crystal and recreate that software, I don't
<FromGitter>
... think anyone here knows near enough about viruses and how they spread.
<FromGitter>
<watzon> The one person I can think of that might have any clue is @ArtLinkov, but he's a busy guy, aren't you Art π haha
<raz>
damianham: yep, what watzon said. also you are jumping to many questionable conclusions (some of which are provably false). that code does not "drive policy". it's one study of many. afaik UK and partially US are the only countries where it got disproportionate media attn. we don't know if the predictions was/is wrong (the world is in lockdown, so of course the observed reality is better than what the model predicted - that's the whole purpose of the
<raz>
lockdowns). etc.
<raz>
also afaik it's not the only model that predicted these numbers. many (all?) epidemiologist worldwide look at this every day with all the tools they have. nearly all countries came to the same conclusion (that a lockdown is needed) and they certainly didn't base that decision on a single foreign study.
renich has quit [Quit: renich]
alexherbo2 has joined #crystal-lang
_ht has joined #crystal-lang
livcd has joined #crystal-lang
gangstacat has quit [Quit: Δis!]
<FromGitter>
<alex-lairan> Hello! β β Small question more architectural than Crystal :slightly_smiling_face: β β I'm coding an app that will generate applications and automatically put them into production. ... [https://gitter.im/crystal-lang/crystal?at=5eb674279f0c955d7db40e42]
<raz>
on an unrelated note: it would be great if the irc bridge didn't truncate messages :(
<FromGitter>
<alex-lairan> Oh :/ From where it truncate ?
<raz>
alex-lairan: sounds like you're in the realm of deployment tools like ansible
<raz>
but really depends a lot on the details
<raz>
alex-lairan: sorry that wasn't directed at you (but at whoever the botmaster is :)). i'm reading with IRC and here we only get half your msg and a link to gitter :/
<FromGitter>
<alex-lairan> The details are that the user will send me an AI in a single file (there are multiple formats for this) β My app will take the file and generate the most appropriate application to read the format and execute AI queries. β β In the first time I will just handle python and TensorFlow, but I will handle more standards in a near future. [https://gitter.im/crystal-lang/crystal?at=5eb675b731a6d25d7cbbcc94]
<FromGitter>
<alex-lairan> My api is in Crystal. I use `.ecr` to generate the Python file and configuration.
<raz>
from the sound of it i'd generally decouple the code generation. people may want to deploy in different envs, there's usually no one size fits all. so maybe just emit a plain python app, then people can deploy it in the same way as they do with other python apps.
<raz>
if you want to make it a turnkey "one-click" solution then releasing it as a docker image could also work
<FromGitter>
<alex-lairan> Yes, I want a one-click solution. β Docker may be a good idea
<raz>
yup docker can do that. many admins are not fans of running opaque docker images in production, but at least that give a solid "just works" starting point and they can still tweak the image from there.
<raz>
ideally you could not only release a static image but a Dockerfile generator. (i.e. emit the python app and a Dockerfile to bundle it up)
iwq has joined #crystal-lang
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
Human_G33k has joined #crystal-lang
return0e has quit [Remote host closed the connection]
HumanGeek has quit [Ping timeout: 240 seconds]
gangstacat has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 246 seconds]
sagax has quit [Quit: Konversation terminated!]
<FromGitter>
<didactic-drunk> @damianham *My* conversation with head of microbiology dept at university that lead to shutdowns in large cities/states (he/she personaly met with governors/mayors urging early shutdowns in Feb). β β Abbreviated txt conversation: β β ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5eb6daf322f9c45c2a7da381]
<FromGitter>
<j8r> It is interesting, but I don't see how it is crystal related.
<FromGitter>
<j8r> It is fine to make quick references of non-crystal stuff, IMHO here it is a bit long :/
<FromGitter>
<j8r> @alex-lairan I'd use caddy instead of nginx, because it has an API
alexherbo25 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<FromGitter>
<watzon> Idk I think it's a fine response. This is the second time in as many days that this guy has put out a call to action for us to rewrite that C++ code in Crystal because the original code is "broken". I doubt this will end it, but hopefully he sees that it's just not a good, or even feasible, idea.
<FromGitter>
<watzon> Same man, same
<FromGitter>
<watzon> Caddy is great
alexherbo25 has quit [Ping timeout: 264 seconds]
<FromGitter>
<didactic-drunk> Next time I'll put everything past the first paragraph in a subthread.
<raz>
j8r: agreed. unfortunately this covid thing not only infects people, but also each and every discussion group that exists anywhere, regardless of what it was originally about :D
<raz>
however, i liked that little diversion, it's interesting to hear what the fellow crystalers think about it. although yes, in general, if we want to talk about viruses, we should keep it about computer viruses in here. :p
<FromGitter>
<watzon> Overall the forum would've been a better place for discussion, but who knows if Damian knows about the forum
<FromGitter>
<didactic-drunk> @j8r this was my short response. There were others I left out, like if you made the software, no one would use it or read the results. The scientists don't use crystal/ruby, so wouldn't validate it. Or want to use it for a variety of reasons. Does anyone have published research paper here? No? Then you won't get published anywhere credible. Know anyone high up in government/research? No? Another
<FromGitter>
... dead end.
return0e has joined #crystal-lang
<FromGitter>
<didactic-drunk> Next time I'll create a forum post and link it.
<FromGitter>
<watzon> Anyone know how I could use `select` to wait for every channel in an array to send once?
<FromGitter>
<didactic-drunk> @watzon Is this for signaling completion?
<FromGitter>
<RomainFranceschini> Agreed, there's no point in reproducing this model in Crystal
<FromGitter>
<RomainFranceschini> On a side note I believe Crystal is a really nice language to do science, I published papers backed by Crystal code and will continue to do so
renich has joined #crystal-lang
<renich>
Good day
<renich>
I wonder... how do you parse an array? I tried `[1, 2, 3].each do |n| {}` but it doesn't work... Is there a preferred way to go through all of an array's elements? I want to do something with them, not to them...
Stephanie is now known as Stephie
<oprypin>
renich, the `{}` is out of place. start a new line instead
<renich>
oprypin: OK. So, the each should work?
<oprypin>
yes
alexherbo2 has quit [Ping timeout: 256 seconds]
<renich>
oprypin: OK. Thanks. Will check it.
<renich>
oprypin: thank you. It works fine. The problem was I used `File.read_lines(file) if File.readable?(file)`. I should've used if File.readable?(file)... `
<FromGitter>
<Blacksmoke16> would be better if you just want to iterate over each line
<FromGitter>
<Blacksmoke16> assuming you dont need the array of lines for some other than just iterating it
<FromGitter>
<watzon> @didactic-drunk yeah. I was thinking about it the wrong way. I just used a buffered channel and did `receive` for each item.
woodruffw has joined #crystal-lang
zorp has quit [Ping timeout: 246 seconds]
renich has quit [Quit: renich]
renich has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter>
<UnsolvedCypher_gitlab> Is there a way to force a type not to be nil? Do I need to cast it to what I want it to be, or use a ternary if to handle the nil case, or is there a cleaner awy?
<FromGitter>
<Blacksmoke16> `.not_nil!`
<FromGitter>
<Blacksmoke16> but id think about if you can rework things to not need it
<FromGitter>
<Blacksmoke16> i.e. what does `nil` represent, what should happen if the value is `nil` etc
<FromGitter>
<UnsolvedCypher_gitlab> Oh, I completely missed that, thank you!
<FromGitter>
<Blacksmoke16> if you need to use it a lot there prob is a better way to do something
<FromGitter>
<UnsolvedCypher_gitlab> Yes I do realize that it's typically poor practice, this is for a quick script I only need to run once and I'm just trying to do .index of an element that I already know exists
<FromGitter>
<Blacksmoke16> π
<FromGitter>
<Blacksmoke16> other option would be like
<FromGitter>
<watzon> Oh yeah, you probably could! I'm hoping to take the individual pieces of this and actually build out a terminal UI library in pure Crystal
<FromGitter>
<watzon> I don't think I could make an enum work here, unless I were to make an enum on top of the hash. The hash is because I'm mapping the key's control character to a key name.
<FromGitter>
<watzon> I guess I could map it to an enum value
<FromGitter>
<watzon> But I'd still need the control character map
<FromGitter>
<j8r> why names?
<FromGitter>
<j8r> you can do with enums
<FromGitter>
<watzon> Doesn't have to be names specifically, mapping to an enum value would work
<FromGitter>
<Blacksmoke16> you can define methods on enums remember
<FromGitter>
<j8r> `Enum#parse(String)`
<FromGitter>
<j8r> I made a terminal editor, so definitely possible
<FromGitter>
<watzon> Fair, but I'd still need a key map
<FromGitter>
<watzon> I'll look into refactoring it to use an enum now
<FromGitter>
<Blacksmoke16> something like that `Key::CTRL_A.some_method`?
<FromGitter>
<j8r> @watzon where do you need the map?
<FromGitter>
<j8r> Can be done with macros anyway
<FromGitter>
<j8r> Using an enum helps to match the key code with its meaning
<FromGitter>
<watzon> Maybe I'm just not understanding. Right now I'm using the map because I need to match a key control character to the name of the key. I could map to an enum value instead, or use an enum method to parse the control character to a value, but I still need a map that says which control character is which value, no?
<FromGitter>
<watzon> Unless I just use a giant case statement, but isn't using a constant hash more efficient?
<FromGitter>
<j8r> When reading the character, you got a integer, right?
<FromGitter>
<j8r> This integer, then, is matched with an enum member
<FromGitter>
<watzon> Actually yes haha, you're right
<FromGitter>
<watzon> I forgot that the control character started as an integer
<FromGitter>
<j8r> I have done in a way, I see you use an other logic with `cooked` etc. β I don't know what is the proper way :/
<FromGitter>
<j8r> But it does not seem there is a buffer?
<FromGitter>
<watzon> A buffer for pressed keys?
<FromGitter>
<j8r> yeah
<FromGitter>
<j8r> For instance, when I copy paste
<FromGitter>
<watzon> I've gotta refamiliarize myself with my work for a bit haha, I made this like a month ago and haven't touched it much since
<FromGitter>
<j8r> `Int#unsafe_chr` is useful in this case :)
<FromGitter>
<j8r> (I wonder why they omit the `a` in `chr`)
<FromGitter>
<watzon> Shorter I guess haha
<FromGitter>
<watzon> Idk
woodruffw has quit [Excess Flood]
woodruffw has joined #crystal-lang
hightower2 has joined #crystal-lang
<hightower2>
Hey which version of llvm is supported by crystal? 8 or?
<FromGitter>
<Blacksmoke16> 6+ i think?
<FromGitter>
<Blacksmoke16> can prob just use the latest if you have choice
<hightower2>
hm yeah... looks like the default binary pkgs are compiled with 8 though. ( crystal eval 'p ::Crystal::LLVM_VERSION' )
<FromGitter>
<Blacksmoke16> so?
<hightower2>
nothing, just checking :)
<FromGitter>
<j8r> ho too bad, there is no `None` for samesite cookies :(
<FromGitter>
<j8r> sending a PR
<FromGitter>
<Blacksmoke16> π
return0e has quit [Remote host closed the connection]
<FromGitter>
<j8r> > Browsers are migrating to have cookies default to SameSite=Lax. If a cookie is needed to be sent cross-origin, opt out of the SameSite restriction using the None directive. The None directive requires the Secure attribute.