<FromGitter>
<sotrhRaven> I get the same issue if I use crenv, or install from the tar file. Currently my distro does not have it in the repo. This is keeping from using crystal. :(
cptaffe has quit [Ping timeout: 255 seconds]
byteflame has quit [Ping timeout: 240 seconds]
braidn[m] has quit [Ping timeout: 255 seconds]
watzon has quit [Ping timeout: 252 seconds]
kp666[m] has quit [Ping timeout: 255 seconds]
Renich has quit [Ping timeout: 255 seconds]
crse[m] has quit [Ping timeout: 240 seconds]
logen[m] has quit [Ping timeout: 256 seconds]
desdeux[m] has quit [Ping timeout: 240 seconds]
<FromGitter>
<sotrhRaven> I get the same issue if I use crenv, or install from the tar file. Currently my distro does not have it in the repo. This is keeping from using crystal. :(bcc
galstar[m] has quit [Ping timeout: 255 seconds]
<FromGitter>
<sotrhRaven> Bcc
olbat[m] has quit [Ping timeout: 276 seconds]
fifr[m] has quit [Ping timeout: 276 seconds]
sotrhraven_droid has quit [Quit: -a- IRC for Android 2.1.38]
duane has joined #crystal-lang
<FromGitter>
<bew> Where is it installed? And what is the output of `crystal env` ?
<FromGitter>
<bew> @sotrhRaven ˆ
olbat[m] has joined #crystal-lang
jokke has quit [Ping timeout: 256 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<aisrael> Am trying the sample code in this article https://www.johnhawthorn.com/2018/02/playing-with-ruby-jit-mjit/ and was getting a discrepancy in the output between the same code (with just a `”fail”` message parameter to `raise`) between `ruby 2.5.0p0` and `crystal 0.2.4.1`
<FromGitter>
<aisrael> I’ve traced it down to `1092455 * 16807 % 2147483647` which evaluates to `1181022009` in Ruby, but to `1181022001` in Crystal
<FromGitter>
<aisrael> I’ve tried putting `_i32` and `_i64` to see if it was like, an overflow thing but that didn’t matter
<FromGitter>
<imonmyown> Ruby seems to give correct result
<FromGitter>
<bew> @sotrhRaven what do you have in `/home/sotrhraven/.asdf/installs/crystal/0.24.1/src` ? Is there a `prelude.cr` file?
<Papierkorb>
`p 1092455i64 * 16807i64 % 2147483647i64` gives the same result as ruby for me.
<FromGitter>
<imonmyown> apparently i32 is assumed in the last example
<Papierkorb>
Ruby does automatic 'infinite' size extension, most other languages do not. Crystal ccould be more smart about it in some places, but all numbers in that snippet fit in the default int32 type, so it's used.
<Papierkorb>
And that's sensible on Crystals part
<FromGitter>
<sotrhRaven> there is in that dir the following dir /crystal/bin and a lib dir that has libgc.a
<FromGitter>
<sotrhRaven> searching for prelude.cr
<FromGitter>
<imonmyown> that's a performance tradeoff of some kind, I believe Ruby's computation in orders of magnitude slower
<FromGitter>
<sotrhRaven> no results
<FromGitter>
<aisrael> Ahhh… sorry. Yeah, `_i64` gives the expected result on my end
<FromGitter>
<aisrael> At the very least, I’d hope that if we `def foo(x : Int64)` then `foo(1)` should automatically promote?
<Papierkorb>
Such auto-detection is on the todo list
<FromGitter>
<aisrael> (Maybe have a `--strict` compile time flag?)
<FromGitter>
<aisrael> Good to know, thanks!
byteflame has joined #crystal-lang
Renich has joined #crystal-lang
braidn[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
logen[m] has joined #crystal-lang
kp666[m] has joined #crystal-lang
crse[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
watzon has joined #crystal-lang
galstar[m] has joined #crystal-lang
desdeux[m] has joined #crystal-lang
<FromGitter>
<sotrhRaven> giving the install by tar file another try
<FromGitter>
<sotrhRaven> rror in main.cr:1: while requiring "qt5": can't find file 'qt5' relative to '/home/sotrhraven/Dev/Crystal/Qt/test'
<FromGitter>
<sotrhRaven> CRYSTAL_CACHE_DIR="/home/sotrhraven/.cache/crystal" ⏎ CRYSTAL_PATH="/opt/crystal/bin/../share/crystal/src:lib" ⏎ CRYSTAL_VERSION="0.24.1" ⏎ symbolic link for crystal and shards to /usr/local/bin [https://gitter.im/crystal-lang/crystal?at=5a7a58f3ce68c3bc74548808]
<FromGitter>
<faustinoaq> @sotrhRaven Do you have qt5-dev dependencies installed?
<FromGitter>
<faustinoaq> What distro are you using?
<FromGitter>
<sotrhRaven> yes Solus
<FromGitter>
<faustinoaq> Oh, I'm afraid that Solus had some incompatibilities issues with Crystal in the past 😅 ⏎ ⏎ ^ RX14
<FromGitter>
<sotrhRaven> No, really
<FromGitter>
<sotrhRaven> well I have to figure something out. I love using solus. The dev team is awesome. Thanks for the help.
<FromGitter>
<faustinoaq> @sotrhRaven I'm using Manjaro Linux and looks like qt5 is working fine here
<FromGitter>
<sotrhRaven> @faustinoaq I have been using solus for a very long time now. Not up to moving any time soon. I was sure it worked. Just wanted to have it work on my system.
duane has joined #crystal-lang
<FromGitter>
<sotrhRaven> I would do gui stuff in ruby, but well ......
<FromGitter>
<faustinoaq> @sotrhRaven Ok, no problem, I'm sure that RX14 has some comments about Solus, Maybe he can help you 😅
<Papierkorb>
wasn't solus the distro with the broken target triple?
<faustinoaq>
Papierkorb, I think so ;)
<faustinoaq>
Papierkorb, WDYT would be a solution for Solus? Supporting a new target triple?
<Papierkorb>
if it was that, then Solus fixing its target triple.
<Papierkorb>
It doesn't make sense for every project out there to change what works for every other linux distro
<Papierkorb>
Including non-GNU linux distros at that
<faustinoaq>
Perhaps, Solus want to be "different"
<Papierkorb>
Then people using Solus should step up and do the work
<Papierkorb>
That'd be the price if you wanna be different just because
<faustinoaq>
XD
<Papierkorb>
But that wouldn't make much sense by itself. you can build a fancy UI or installer or what Solus actually provides without breaking every other project on the planet
<Papierkorb>
So it's probably a bug in some place
faustinoaq has quit [Quit: IRC client terminated!]
snsei has joined #crystal-lang
byteflame has quit [Ping timeout: 240 seconds]
cptaffe has quit [Ping timeout: 248 seconds]
fifr[m] has quit [Ping timeout: 256 seconds]
Renich has quit [Ping timeout: 256 seconds]
crse[m] has quit [Ping timeout: 240 seconds]
kp666[m] has quit [Ping timeout: 260 seconds]
logen[m] has quit [Ping timeout: 256 seconds]
braidn[m] has quit [Ping timeout: 240 seconds]
watzon has quit [Ping timeout: 255 seconds]
desdeux[m] has quit [Ping timeout: 252 seconds]
galstar[m] has quit [Ping timeout: 248 seconds]
olbat[m] has quit [Ping timeout: 276 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
faustinoaq has joined #crystal-lang
duane has quit [Ping timeout: 265 seconds]
duane has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
codeprime has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
greengriminal has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<crystal-gh>
[crystal] stakach opened pull request #5683: Fix: HTTP::FormData parsing of multipart subparts (master...form-encode-subpart) https://git.io/vAvxs
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
duane has quit [Ping timeout: 255 seconds]
duane has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
snsei has quit [Remote host closed the connection]
codeprime has quit [Ping timeout: 260 seconds]
cptaffe has joined #crystal-lang
Renich has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
<FromGitter>
<Qwerp-Derp> I think I should start a new branch off of libui.cr which focuses on implementing OOP, since I'm pretty sure Fusion has completely abandoned it at this point
<FromGitter>
<Qwerp-Derp> If anyone's interested in helping I'll start a new repository (I need name ideas for the plugin, if anyone wants to offer one I'm all ears)
<FromGitter>
<sam0x17> ^ very much want this
vegai has left #crystal-lang [#crystal-lang]
<FromGitter>
<sam0x17> but unfortunately don't have much time to work on it
Groogy_ has quit [Quit: WeeChat 1.9.1]
mark_66 has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
alex`` has quit [Ping timeout: 276 seconds]
<FromGitter>
<straight-shoota> @Qwerp-Derp Sure that's worth it... libui itself does not see very much acitvity
<FromGitter>
<straight-shoota> ?
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
n7olkachev has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #5685: Fix custom array/hash-like literals in nested modules (master...bug/5684-custom-nested-array-hash) https://git.io/vAfPt
n7olkachev has quit [Quit: WeeChat 1.9.1]
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
greengriminal has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
<FromGitter>
<asterite> @bew @sam0x17 that's different than how fibers work in crystal
duane has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
duane has joined #crystal-lang
<RX14>
i don't think i've actually ever used inheritance in crystal
<Papierkorb>
Wat.
<RX14>
i mean why bother when you can just use modules for everything
<Papierkorb>
Cause sometimes the base class is useful on its own, and is instantiated on its own
<RX14>
it's just because i've ever actually written a large program in crystal
<Papierkorb>
And writing a module with an basically empty class doesn't look right, having an initialize in a module looks wrong too
<RX14>
I'm not arguing against inheritance
<RX14>
it's just something I founds funny
<RX14>
it's just something I found funny
<Papierkorb>
Though I'd be fine if `class X < Y, Z, ...` was possible and would include modules if given there
<Papierkorb>
Might as well get rid of the `include` keyword if it has no other use
<Papierkorb>
RX14: The difference, really, is if you need the user to give you strong guarantees (-> inheritance), or if you're fine with weak ones (-> composition)
<RX14>
is include really composition though?
<RX14>
I always think of composition of just owning a reference to an object
LastWhisper____ has joined #crystal-lang
<Papierkorb>
In an emulator e.g. I have a base class for CPU core implementations and use inheritance for that (the base class also has useful methods and an initialize). However, there's also a SurfaceManager module which you pass to the graphics renderer so it can request new pixel buffers from the frontend.
<Papierkorb>
You may be thinking of the "Decorator Pattern", which is kinda composition too.
<RX14>
yeah maybe
greengriminal has quit [Quit: This computer has gone to sleep]
<RX14>
but with less bullshitr interfaces
hightower has joined #crystal-lang
<Papierkorb>
mh? a decorator thing is less useful in the general case. You can ask the dev that an object needs to fulfill modules A and B. You can't ask the dev to give you an A, and then use a decorator to turn it into an B without giving the dev the chance to modify the behaviour in the B context
<Papierkorb>
Which sometimes you want, and sometimes you don't. Also kinda plays into the strong/weak thing.
<RX14>
it's just whenever I see people inheriting a class that they didn't write and wasn't intended to be inherite from (i.e. array)
<RX14>
I think please just wrap array and add your behaviour like that
<RX14>
Perhaps we should have final/sealed/whatever classes
<Papierkorb>
Issue is that some think of "inheritance" as "inheriting the structure", and not as "inheriting outside behaviour". See the guy a month ago who tried to write a game Client and inherited it from the games Server class.
<Papierkorb>
Though inheritance is so fundamental of a pattern, that's really just OOP 101.
<RX14>
Maybe I should start going to my OO 101 lectures after all
<Papierkorb>
As long we advocate that "final" shouldn't be used for everything just because you can, it may be useful. Though a standard macro that adds a inherited hook to error at compile time could be just fine.
<Vexatos>
I mean that's how Java does it
<RX14>
although the lecturer seems to think that implementing dynamic dispatch is the very first task that his students should write in Java
<Vexatos>
you can have final classes, but noone uses it unless actually intended
<RX14>
which i'm like, what why
<RX14>
I'm annoyed that me lecturer is basically teching a limitation of java (lack of dynamic dispatch on anything but the reciever) as a fundemental piece of the course
<RX14>
instead of just a passing mention
<Vexatos>
I assume he doesn't like Java
<RX14>
I don't know
<Papierkorb>
I mean we don't have a "final", "sealed" or "const" keyword already, so I'd prefer a macro-based solution. `cant_inherit_class!("Inherit from Base instead")` may just as easy to see in the code, and could also provide the dev with a useful error message on top of that
<RX14>
I'd prefer just `seal_class!`
<Vexatos>
Still better than the teacher of a certain student I know who always uses the worst Java features at the worst possible point in his code and teaches that as good practice
<Papierkorb>
RX14: "seal" would add a new word into the languages terminology, "inheriting" is already part of it
<Vexatos>
RX14, I mean if it's a macro for a class I'd just call it seal!
<Papierkorb>
I mean it's not wrong, I wouldn't fight it, but I wonder if it's worth it adding a new word
<RX14>
ehh
<RX14>
Vexatos, disagree
<RX14>
it's far less intuitive that just a random `seal!` line in the body
<RX14>
that can be placed anywhere
<RX14>
and is not visibly related to the class keyword
<RX14>
it's just not clear that it relates to inheritance at all
<Papierkorb>
Yeah hence my snippet using an overly long name, so it can stand out
<Vexatos>
the longer you make it, the less likely it's going to be used everywhere thanks to the law of lazy, so I guess that would be a good thing
<RX14>
you have a bunch of proxy methods in Animal which are literally copies of each other
<RX14>
just to do dynamic dispatch
<RX14>
and this is the first lab
<RX14>
and i'm just thinking what why
moei has joined #crystal-lang
<Papierkorb>
I was lucky we never did Java much. Assembler was actually much more fun
<Vexatos>
wait, aren't all those methods the same?
<RX14>
yep Vexatos
<Papierkorb>
Was kinda refreshing how people did come up with vastly different solutions to the homework
<Vexatos>
but why
<RX14>
the only difference is the type of `self`
<RX14>
tow ork around the lack of dynamic dispatch Vexatos
<RX14>
well we started with C and Haskell
<RX14>
and the haskell lecturer was really good
<Vexatos>
RX14, why not just actually write good code? Most teachers are fine with it as long as they can read it
<RX14>
and the C lecturer had really good opinions about C
<RX14>
Vexatos, sure it's not even marked
<Vexatos>
Since rumour has it that you already are familiar with the language :P
<Papierkorb>
Vexatos: Why bother, the stress of a potentional failure caused by that isn't worth risking a class. If the prof says "jump", then the code jumps. Whatever.
<RX14>
but do you think all the people that have never used java will come and think this is atypical?
<RX14>
no
<Vexatos>
Papierkorb, I got better grades for disagreeing with teachers :P
<RX14>
I've used java quite a bit
<RX14>
never had to implement proxy dispatch like this
<Papierkorb>
Vexatos: Highly depends on the prof, a good sport will do that
<RX14>
but this prof is teaching it in OOP 101
<RX14>
and thats what i'm pissed about
greengriminal has joined #crystal-lang
<Vexatos>
Papierkorb, maybe I was just lucky then
<RX14>
this is nothing to do with whether he would accept it
<Vexatos>
RX14, dynamic dispatch is quite the opposite of pure OOP
<RX14>
I know he would accept it
<Papierkorb>
RX14: Will it change your life for the worse in the next 2 years? If no, just carry on. Life's too short to care about minor details.
<RX14>
the problem is that he teaches this in lectures at all
<RX14>
Papierkorb, i'll have to do group projects with these people
<RX14>
why would I want them to get weird ideas about OOP
<Papierkorb>
Well the first homework/labs are weird anyway. Give it a semester
<Papierkorb>
Ah don't worry, group projects will suck in any case
<RX14>
true
<RX14>
luckilly OOP work is only pairs
<Vexatos>
From what I've heard about programming classes in general, I am yet again glad I didn't choose to study any computer science, heh
<RX14>
and I chose my friend so I can just force him to use gradle and a real IDE and use git corectly and do OOP correctly
<RX14>
Vexatos, first year CS is bs
<RX14>
then itg ets good
<Papierkorb>
Vexatos: Depends, really. There are a ton of factors.
<Vexatos>
From what I heard the first three to four semesters are gloriously boring
<RX14>
honestly the C and Haskell classes were really good
<Vexatos>
if you have any idea about what an if statement is
<RX14>
the C class was less about C and more about how to write good idiomatic code
<RX14>
the Haskell class was very good too
<Papierkorb>
CS is usually way too math heavy, while almost completely omitting algorithms and data structures
<RX14>
really?
<Papierkorb>
Was at least in my uni
<RX14>
it's been a good balance so far in my uni
<livcd>
i thought people usually fight with linear algebra and discrete math in first semester
<RX14>
as I said I really enjoyed my C and Haskell lectures
<Vexatos>
I know (and regularly talk to) a fair number of CS students are various unis all over the world, and they all say similar things, mainly just how boring most of it is :/
<RX14>
they were genuinely engaging to me
<Papierkorb>
In my it was 2/3 math, 1/3 computer-stuff in the first 3 semesters
<RX14>
even though I know the syntax of C
<RX14>
the C lecture was much more than that
<Papierkorb>
And then you begin to think that you didn't sign up for this shit, if you wanted to, you would've chosen math.
<RX14>
lol
<RX14>
i'm doing computer science and electronics
<Papierkorb>
The "informatik" lectures were awesome though. The course in the second semester thought you how stuff really works.
<FromGitter>
<stevensonmt> Noob question here: I have an old ruby/sinatra app that I'm trying to migrate to crystal but it makes use of ruby's String.to_sym method for dynamic method calls. I'm struggling to find an equivalent in crystal. Any suggestions?
<Vexatos>
I had three years of that in school
<Vexatos>
information theory
<Papierkorb>
I mean, after that you could go home and literally build a simple processor out of logic gates and transistors. Awesome stuff.
<Vexatos>
and a lecture at uni, why do you even have such a lecture in Chemistry
<RX14>
@stevensonmt there isn't a replacement for that method
<RX14>
and there's no dynamic method calls
<Papierkorb>
stevensonmt, there's none. Check if you *really* need it first. If you do, you can use 1) a switch statement or 2) a Hash(String, Proc(...)) for 'lookup' - In this order, the more static the easier your life will be
<RX14>
yeah in computer architecture labs here you build a processor out of small parts that car hooked up over RJ45
<RX14>
so you get a 4-bit register, a clock, etc,
<RX14>
and you hook it up into a computer
<RX14>
it's cool
<Vexatos>
At least I still get to do computer science in my free time
<Papierkorb>
Much Object#send-heavy code in ruby can be rewritten to not need it without much effort, especially when you're porting and are essentially rewriting it anyway
<Papierkorb>
Vexatos: Point in case is, university doesn't train you for the free market. They train you on doing scientific work. Which is fine by itself, but it always seemed like that's overlooked by many
<RX14>
I think my uni is actually OK for that Papierkorb, at least so far
<Vexatos>
I mean at least in Germany that is a valid thing to do, since there are three different computer sciences to study, and "Programmer" is a trained profession not taught at uni
<Vexatos>
"computer science" has science in its name
<Papierkorb>
Vexatos: Yeah well I switched from a Uni to FH, where I was bored to death but I get a my BSc anyway.
<RX14>
I'm actually not super invested in finishing my course
<Papierkorb>
-a
<Vexatos>
So it makes sense it focuses more on the academic side
<RX14>
FH?
<Vexatos>
Fachhochschule
<Vexatos>
it's, like
<Vexatos>
uuuh
<RX14>
all I can think of is falcon heavy lel
<Papierkorb>
RX14: Not sure if it even exists outside Germany. It's kinda like university, but much more practice focused
<FromGitter>
<stevensonmt> @RX14 and @Papierkorb thanks. I don't REALLY need it as I could do pattern matching, but it's a lot of patterns (276)
<Vexatos>
a lesser version of a university? Less academic more applied
<Vexatos>
and you don't need an Abitur to get there
<RX14>
@stevensonmt would it be possible to see the original code?
<Papierkorb>
stevensonmt, If it's a ton, a macro may help you.
<Vexatos>
Papierkorb, I am studying chemistry which is _extremely_ academic so I may be biased, but I think computer science at a university actually focusing on the theory behind everything makes a lot of sense
<Papierkorb>
Vexatos: I'm not saying "no math in CS!". But I'm complaining about that the big thing about math is not math, but learning how you approach it. Teaching that is invaluable. And for that, a more computer-focused math would be much more interesting.
<Papierkorb>
Vexatos: And CS is such a vast field beyond math
<FromGitter>
<stevensonmt> the code is embarrassingly bad and should just be rewritten. I wrote it when first learning ruby.
<FromGitter>
<j8r> @RX14 Hello, I'm (still) working on the cross compilation, it was able to get a `crystal.o` on Arch Linux, but on Alpine Linux (musl), I get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ The same occurs when I cross compile [https://gitter.im/crystal-lang/crystal?at=5a7b1c0cce68c3bc7458920d]
<Vexatos>
I mean I also had two semesters of advanced mathematics, but those were then followed by quantum mechanics and quantum chemistry lectures which made us actually put all that weird stuff we learnt to good use
<Vexatos>
learn maths first, apply them later
<RX14>
musl and glibc are different target tripples
<RX14>
if you're compiling for musl you need to use --target x86_64-linux-musl
<RX14>
if you have crystal installed already you only need the source files
<FromGitter>
<j8r> its looks at my crystal in /usr/local/bin
<FromGitter>
<j8r> on my PATH
<RX14>
again - there's already a prebuilt compiler for alpine linux
<RX14>
why are you doing this?
<FromGitter>
<j8r> From ysbadadden yes
<FromGitter>
<j8r> Simply because i would like to have a statically linked one a the end
<RX14>
use ysbaddaden's package
<FromGitter>
<j8r> no
<RX14>
and then statically link a new compiler
<RX14>
using that
<FromGitter>
<j8r> I can't
<RX14>
why?
<FromGitter>
<j8r> You have said that i need exactly the same packages across x86_64, armhf and aarch64
<RX14>
what?
<FromGitter>
<j8r> The goal is to have a crystal compiler for aarch64 and armhf on Alpine
<FromGitter>
<asterite> The difference between class and module inheritance is that modules duplicate the code, while inheritance share it. So having only modules would make everything pretty bloated. Of course, this is an implementation detail, so it's ugly that it leaks to the syntax.
<FromGitter>
<j8r> We need to bootstrap this, right?
<RX14>
yes
<RX14>
but we don't support aarch64 on musl do we?
<RX14>
no we don't
<RX14>
probably not too hard to implement
<FromGitter>
<j8r> yes, remember I'm working on it ;)
<RX14>
but currently we don't
<RX14>
ok fair enough
<RX14>
but yeah you shouldnt be getting that error
<RX14>
im a lot confused by what you've done to get it
<FromGitter>
<imonmyown> @Papierkorb got anything from me?
<FromGitter>
<j8r> The ultimate goal of all of this: statically-linked crystal compiler build on Alpine Linux (musl) for x86_64, armhf and aarch64
<RX14>
@asterite it would be nice if you could "just" implement code sharing for modules :)
<RX14>
I know why you can't
<RX14>
perhaps in the future we could perform some kind of rearranging ivar "memory blocks" to attempt to get the fewest binary layouts and then we could have sharing for modules too
<RX14>
but thats justinsane
<FromGitter>
<j8r> arrrff still :(
<FromGitter>
<j8r> I can post you all the commands done in a PM
<FromGitter>
<asterite> RX14: I think it's possible, we just need to compute whether a module defines instance variables. In fact we had that idea so that a module without instance vars would be like an interface. Maybe it can be done automatically, I don't know (though I don't plan to implement that myself anytime soon, of course)
<RX14>
yeah
<RX14>
I think it'd be nice if eventually inheritance and including could have mostly the same codepath and behaviour
<RX14>
although i'm not sure if the edge cases would allow that
<RX14>
it'd be fun to try though
<Papierkorb>
implementation-is-inclusion would be neat and actually allow to make the language more strict without removing possibilities
<RX14>
how so?
<Papierkorb>
Well say I need #[] and #[]= in the object passed in. i make a module of both, as none cover that exact case yet. But now, objects have to include it manually, while many already implement it. the module itself is only abstract methods (*). So the compiler could check it, and then turn it into that module. This would allow the compiler to reduce the code paths from having a ton of instantiations to only one/a few instead
qard has joined #crystal-lang
<FromGitter>
<asterite> You mean, like interfaces in Go
<Papierkorb>
* = If we'd allow also member methods, but no ivars, that'd be an amazing feat and in effect add something like refinements. I'd use that.
<FromGitter>
<asterite> Oh, but even without defining the interface? Hmmm... sounds pretty complex
<Papierkorb>
asterite, don't know Go, but probably.
<Papierkorb>
No you have a module for that
<RX14>
Papierkorb, do you eman it'd automatically "implement" the module?
<RX14>
I really don't want that
<RX14>
Papierkorb, if you create a module with just [] and []=, you'd still have to include it in all the types currently
<RX14>
in Go's interface that happens automatically
<Papierkorb>
An object that responds to foo and bar already implements the FooAndBar module, and if I have a method x(y : FooAndBar) then the compiler could turn it into that easily
<Papierkorb>
Yes, Currently.
<RX14>
isn't that just overloading the "module" concept
<RX14>
it's currently a thing you explicitly include and you get methods and behaviour
<Papierkorb>
Yes, it'd make abstract-only modules more useful
<Papierkorb>
Turning them into more useful interfaces
<RX14>
if it behaves magically so you don't need to include that module, but only when it's all-abstract, thats just a different concept in the same name
<RX14>
1) if we do it it shouldn't be called a module
<RX14>
2) i dislike the idea in the first place, interfwces should be explicit like java
<Papierkorb>
Why not? Why add yet another keyword?
<Papierkorb>
No Javas type system is crap
<RX14>
because it's an entirely different concept
<RX14>
just don't specity a type restriction
<RX14>
and don't use them as ivars because implementing that would basically be impossible without autoboxing
<Papierkorb>
I'd like to help the developer through type restrictions, telling them what interface I'm looking for
<RX14>
Is it really that common?
<Papierkorb>
And for the compiler to tell me to get lost if I fail to adhere to that interface
<Papierkorb>
It's a more strict kind of duck typing
<RX14>
I think it doesn;t fit the language
<RX14>
and I'd hate to see people define random interfaces for their methods
<RX14>
I just don't find myself ever reaching for something like that
<RX14>
My argument is that the chances of an interface arising on a bunch of unrelated types (if they are related, just use a module/class hierarchy) with exactly the same interface both in types and in semantics is so rare
<RX14>
I just can't see it happening
<RX14>
and if that is happening across many different objects then surely it should be defined in an existing module in the stdlib or in some library they all share
<RX14>
there's so much more to an interface than just the types because behaviour isn't encoded in the type system
<RX14>
*thats* why I dislike go's magical interface
<RX14>
it's just so easy to get code that compiles but is semantically wrong
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
imonmyown has quit [Ping timeout: 260 seconds]
<FromGitter>
<aisrael> FWIW I’m with @RX14 on this. If you want “duck typing”, Crystal allows us to just not specify a type restriction. If you want restriction, we also have base classes (Go doesn’t *have* classes at all).
<Yxhuvud>
I dislike that kind of behaviour as it seems like action at a distance to me.
<FromGitter>
<aisrael> I’m kinda intrigued by the idea of a methods-only module, though, and how I might use *that* as a type annotation (basically, like Java interfaces as mentioned).
<FromGitter>
<aisrael> @yxhuvud Which one? Base classes?
<RX14>
I dislike magic in general
<RX14>
and Go's interfaces certainly are magic
greengriminal has quit [Ping timeout: 240 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Ping timeout: 268 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Ping timeout: 260 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Ping timeout: 260 seconds]
dragonkh has joined #crystal-lang
<dragonkh>
hi - what is a nice way to get the last 4 chars in a string?
<dragonkh>
maybe? my_string.reverse[0..4]
<Papierkorb>
`str[-4..-1]`
<dragonkh>
ah great thanks
vivus has quit [Ping timeout: 255 seconds]
<FromGitter>
<elorest> Looking for advice on complicated Union types. Lets say I expect a value to be an array, I could cast it to an array with as, before calling first, each etc on it. What if someone sends an unexpected value though? Is there a way to verify the underlying type first? Or would rescue be the only way to handle an issue like this. ⏎ ⏎ ```code paste, see link``` [https:/
<FromGitter>
<elorest> Wouldn't that just respond to union type?
<FromGitter>
<elorest> <Papierkorb> #is_a? just checks against #class which in this case is MessagePack::Type. I need to find the type inside of the union.
<Papierkorb>
Please help us help you. What *is* messagepack::type?
<FromGitter>
<elorest> It is an alias for a union. `alias Type = Nil | Bool | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Float32 | Float64 | String | Bytes | Array(Type) | Hash(Type, Type)` to be exact.
<Papierkorb>
Have you tried #is_a?
<FromGitter>
<elorest> I don't really think it's important what is in the union but just that it is. I did try it after you suggested it to confirm my suspicion. It returns false unless the I call `is_a?(MessagePack::Type)`
<FromGitter>
<elorest> <Papierkorb> I have tried is_a? and #class == Type. Neither work since class is union type not underlying type.
<Papierkorb>
You'll have to be more precise.
<Papierkorb>
Please no toy examples.
<FromGitter>
<elorest> rescue works fine it just seems dirty.
<FromGitter>
<elorest> <Papierkorb> Thank you. Turned out that I needed to check for `Array(MessagePack::Type)` instead of `Array(Int32)`. `is_a?` returns true for both underlying type and union type where as class just returns union type. https://play.crystal-lang.org/#/r/3j30
<FromGitter>
<elorest> Thanks a lot for your assistance.
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]