<FromGitter>
<watzon> jokke I'm pretty sure you link in the same way you would if you were trying to use it in a C program
<FromGitter>
<watzon> Other than that idk, you're in unexplored territory for me
<FromGitter>
<watzon> Which is rare. Congrats.
<FromGitter>
<watzon> Lol
<FromGitter>
<watzon> How could I go about type restricting a class instead of an instance? For instance I want instance variable `@foo` to be of type `Bar.class`, not `Bar` but I can't do `@foo : Bar.class`
<FromGitter>
<Blacksmoke16> sure you can
<FromGitter>
<watzon> How? I just tried and it doesn't work
<FromGitter>
<dscottboggs_gitlab> I wish LLVM had some sort of standardized ABI to allow interop between LLVM languages. That would really make all of these obscure but very nice LLVM languages like Rust, Crystal, V, etc, be a lot more useful and verstile -- one language could take advanatage of another's libraries
<jokke>
that's exactly what i'm trying to do :P
<FromGitter>
<dscottboggs_gitlab> *please* fucking do π
<jokke>
i wrote this one lib in rust and want to use it in crystal
<jokke>
but it doesn't seem to be trivial :D
<FromGitter>
<dscottboggs_gitlab> but like I feel like LLVM would need to make that a core feature of the compiler
<jokke>
or i'm just stupid
<FromGitter>
<dscottboggs_gitlab> no you're not it's *incredibly* difficult
<jokke>
llvm is veeeery low level though
<FromGitter>
<dscottboggs_gitlab> that's the level at which you'd need to have interop
<jokke>
why?
<FromGitter>
<dscottboggs_gitlab> because at any higher level the languages would be very different
<jokke>
well all of them support exposing unmangled functions
<FromGitter>
<dscottboggs_gitlab> like a function is a function, an int is an int, but a C++ class is not a Crystal class is not a Ruby class etc
<jokke>
sure
<jokke>
but that's already at c level
<jokke>
or how to say
<FromGitter>
<dscottboggs_gitlab> like you can export a crystal `fun` or `struct` which is marked `@[Extern]` but not a `class` or `def` which is what most libraries would use
<FromGitter>
<dscottboggs_gitlab> Not doing something very complicated tends to lead to not using advanced (ugly) language features
<jokke>
yeah i guess
<jokke>
i don't like the error handling in rust at all
<FromGitter>
<dscottboggs_gitlab> no?
<jokke>
it's way better than in go of course
<jokke>
but i much prefer exceptions
<FromGitter>
<dscottboggs_gitlab> I mean *of course* haha
<jokke>
but that's probably just because i'm used to it
<FromGitter>
<dscottboggs_gitlab> exceptions are expensive
<jokke>
yeah
<FromGitter>
<tenebrousedge> I tend to think of that being pretty irrelevant
<jokke>
but i don't really care
<jokke>
i prefer my code to be readable
<jokke>
exceptions let me keep the code flat
<FromGitter>
<dscottboggs_gitlab> Idk I mean there's a balance to be had
<jokke>
lol i'm going great lengths just to avoid shelling out to xclip :D
<FromGitter>
<dscottboggs_gitlab> If you totally don't care about efficiency but care about your code being readable, modern Python with type hints would be the obvious language of choice in my mind, unless your working with web server stuff specifically then I'd go with Crystal.
<jokke>
and now it's 3:15am
<jokke>
ugh i hate python
<FromGitter>
<dscottboggs_gitlab> Pyhon + web = π¬
<FromGitter>
<tenebrousedge> apparently there's type checking for Ruby too
<jokke>
it's such a broken language
<jokke>
i prefer crystal over ruby in almost any case
<FromGitter>
<dscottboggs_gitlab> > and now it's 3:15am β β oof get some rest bro
<jokke>
yeah. gotta go to work tomorrow :D
<FromGitter>
<dscottboggs_gitlab> which is a broken language, python or ruby?
<jokke>
python
<FromGitter>
<dscottboggs_gitlab> why's that?
<jokke>
imo
<FromGitter>
<dscottboggs_gitlab> I mean like Python3.6+
<jokke>
i mean it's getting better since list comprehensions but i think it's a very limited function which doesn't really inspire you to write good code
<jokke>
s/function/language/
<jokke>
as opposed to ruby
<jokke>
if you want to talk about interpreted languages
<jokke>
ruby is a very beautifully crafted consistent language
<FromGitter>
<dscottboggs_gitlab> I don't think it's very consistent
<jokke>
pythons version of OO is a joke in comparison
<FromGitter>
<dscottboggs_gitlab> Ruby is a little to flexible for my taste
<jokke>
you mean because of aliases?
<jokke>
yeah
<jokke>
ok
<FromGitter>
<dscottboggs_gitlab> not just aliases but like type inference and stuff too
<jokke>
type inference in ruby?
<jokke>
with consistency i meant the OO model of ruby
<jokke>
no null pointers, no weird things that aren't objects.
<FromGitter>
<tenebrousedge> everything is a message sent to an object
<jokke>
yeah
<FromGitter>
<tenebrousedge> and almost anything can be redefined at runtime
<FromGitter>
<dscottboggs_gitlab> > and almost anything can be redefined at runtime β β doesn'
<jokke>
not necessarily
<FromGitter>
<tenebrousedge> there are safe ways to redefine things
<jokke>
but i'm not a huge fan of crazy metaprogramming magic
<jokke>
sometimes it just gets too much with ruby, although i think it's commonly viewed as a last resort instead of the norm
<jokke>
kinda like crystal macros
<FromGitter>
<dscottboggs_gitlab> I can't run `shards install` on my project
<FromGitter>
<dscottboggs_gitlab> there's no error -- it jus stops there
<FromGitter>
<Blacksmoke16> rip
<jokke>
ameba takes some time
<jokke>
sure it stops forever?
<FromGitter>
<Blacksmoke16> normally it says its making bin tho
<jokke>
yeah true
<FromGitter>
<dscottboggs_gitlab> i left it sit while I went out to the store yesterday or the day before
<jokke>
heh ok it shouldn't take that long
<jokke>
maybe 10 secs
<jokke>
Blacksmoke16 any ideas bout that linking issue?
<FromGitter>
<dscottboggs_gitlab> yeah it usually stops on the postinstall make step for a while, this is after the last thing is fetched
<FromGitter>
<Blacksmoke16> naw man, i know like nothing about c
<FromGitter>
<dscottboggs_gitlab> I've uninstalled and reinstalled `crystal`, and `shards`, as well as removed the data in `~/.cache/shards`
<jokke>
i should maybe ask jhass. I think he made some lib with locally built shared objects..
<jokke>
but it's 3:30am for him, too. so maybe i should just call it a day :D
<jokke>
night guys. Thanks for the help!
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<tenebrousedge> this whole "round Earth" thing was just a bad idea. No one likes time zones >_<
<FromGitter>
<Blacksmoke16> what are you talking about? the earth is flat
<FromGitter>
<dscottboggs_gitlab> well...it may not be 03:30 here but I'm going to bed anyway. I hope I can figure out this shards issue so I can code on my primary system again soon
<FromGitter>
<dscottboggs_gitlab> good night βοΈ
<FromGitter>
<watzon> I loved Antergos, but the project is dead now
<rkeene>
What thing should I do while I'm in Seattle ?
<FromGitter>
<tenebrousedge> the Pike Place Market is fun
<FromGitter>
<tenebrousedge> they will throw fish at you o_o
<rkeene>
What if I don't want things thrown at me ?
<FromGitter>
<dscottboggs_gitlab> > Delays package updates for 'testing' and yet still completely breaks with a regular update β β Ooof
<FromGitter>
<tenebrousedge> there is a lovely tea shoppe there too
<rkeene>
I just got finished with an over 4 hour interview process
<rkeene>
So, things that don't require thinking, or talking
<FromGitter>
<watzon> I tried Manjaro for several months a couple years ago. Had nothing but issues. Antergos was nice because it was pure arch, just with packages installed.
<FromGitter>
<dscottboggs_gitlab> TBH I've been wishing I had the horsepower for silverfish or something immutable. I had an idea awhile back to install AUR packages into docker containers but never got it working with GUI
<rkeene>
dscottboggs, What you need is AppFS :-D
<FromGitter>
<dscottboggs_gitlab> I haven't had any issues with Manjaro in a long time. I had an issue or two with dependency hell from too many AUR packages, but since then I've been running it on my laptop for a while and just installed it on my main server/desktop about 2 months ago
<FromGitter>
<dscottboggs_gitlab> rkeene, thank you I'll take a look at that
<rkeene>
Hee hee hee
<FromGitter>
<dscottboggs_gitlab> rkeene, I could swear I've heard of that before, I had no idea you wrote it. Is it really just one C and one TCL file + deps?
<FromGitter>
<girng> can you get the same performance out of python as ruby tho?
<FromGitter>
<girng> as crystal*
<FromGitter>
<dscottboggs_gitlab> @girng, no I specifically said if you don't care about performance
<FromGitter>
<girng> oh ic, yeah
<FromGitter>
<dscottboggs_gitlab> if you do then the decision becomes a lot tougher
<FromGitter>
<dscottboggs_gitlab> Or if you're making a web server
<rkeene>
dscottboggs, I mentioned it to you before, yeah, it's real small -- packages are just files on disk, this handles getting them to a point where you can use them
<FromGitter>
<dscottboggs_gitlab> just tried removing ameba from the shards.yml, didn't help. i'm gonna try building a fresh shards from source and see what happens
<FromGitter>
<dscottboggs_gitlab> shards built from source *also* does the same thing...perhaps there will be a more helpful error since it is built from source rather than static
<FromGitter>
<dscottboggs_gitlab> a freshly compiled shards v0.8.1 does not seem to experience this issue
Yxhuvud has quit [Read error: Connection reset by peer]
ht_ has joined #crystal-lang
Yxhuvud has joined #crystal-lang
absolutejam has quit [Ping timeout: 245 seconds]
duane has quit [Ping timeout: 245 seconds]
absolutejam has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<jokke>
dscottboggs_gitlab: yeah?
<jokke>
have i missed something?
<FromGitter>
<dscottboggs_gitlab> You were asking about linking to crystal?
<jokke>
yeah but that's basic
<jokke>
the problem is building an extension in something other than crystal and linking that extension
<FromGitter>
<dscottboggs_gitlab> You should be able to define `fun`s, and link to it, I think? As long as it's compatible with the C ABI...
<FromGitter>
<dscottboggs_gitlab> like when building C bindings you use the headers to write `fun foo(args : T) : U` for each `U foo(T args);` C function in the headers, then link to the corresponding object file
<FromGitter>
<dscottboggs_gitlab> Wouldn't it work the same for other languages, if they're able to create exportable equivalents of C functions/Crystal `fun`s?
<jokke>
yes :) sure, that's what i'm doing
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<dscottboggs_gitlab> > @[Link(ldflags: "...")] will pass those flags directly to the linker, without modification. For example: @[Link(ldflags: "-lpcre")] β β so you need to figure out how to link your `.so` file to a C library, and what option you need to pass to `clang`/`gcc`, then put that option in a `@[Link]` annotation. β β .... I think [https://gitter.im/crystal-lang/crystal?at=5d2783e13b41924785a0987a]
rohitpaulk has joined #crystal-lang
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
<jokke>
yeah i know :) that's also what i'm doing :P And it's compiling and linking but in the end if i run ldd on the binary i get a not found for the .so file
<FromGitter>
<artmadeit> hi is there a way to extends the Integer types to support factorial with this syntax:`5.!`
<FromGitter>
<Blacksmoke16> like a method called `!`?
<FromGitter>
<artmadeit> yeah, but in the docs says..`Note: ! (not) cannot be defined as a method (its meaning can't be changed).` in the operators section
<FromGitter>
<artmadeit> I'm thinking of leaving it like that, using just factorial, if there's a way (don't if it'll work using macros)
<FromGitter>
<artmadeit> *don't know if it'll work using macros
<FromGitter>
<Blacksmoke16> it wont
<FromGitter>
<Blacksmoke16> you cant have a method starting with `_`
<FromGitter>
<Blacksmoke16> but again, id just do `5. factorial `
<FromGitter>
<Blacksmoke16> but :shrug:
<FromGitter>
<artmadeit> thanks for your replies π
ht_ has quit [Remote host closed the connection]
<FromGitter>
<dscottboggs_gitlab> > you cant have a method starting with `_` β β Oh
<FromGitter>
<Blacksmoke16> i lied
<FromGitter>
<Blacksmoke16> but might be a bug? book says `Method names begin with a lowercase letter `
<FromGitter>
<bew> you can use a unicode exclamation mark like `β`: https://carc.in/#/r/77kv But good luck with telling people to copy/paste the symbol everytime they want to use it :D
<FromGitter>
<bew> ahah I would never merge something like that, even in my dreams
<FromGitter>
<bew> about `_!`, could be a bug, as a method named `_bla` works well, but I wouldn't say making `_!` work is super duper high priority^^
<FromGitter>
<Blacksmoke16> id even be for making `_bla` throw an error
<FromGitter>
<bew> not necessarily, could be useful semantic-wise to show a clear distinction between some public-public method and some public-but-internal (for example) methods
<FromGitter>
<dscottboggs_gitlab> > I wouldn't say making _! work is super duper high priority^^ β β I didn't think so π
<FromGitter>
<Blacksmoke16> `public-but-internal ` like what?
<FromGitter>
<Blacksmoke16> that you could use protected or private for
<FromGitter>
<dscottboggs_gitlab> idk I'm more for like, don't break things unless you have to. If the syntax doesn't break things let people do it
<FromGitter>
<bew> no example in mind @Blacksmoke16, I just feel like there could be a usecase like that
<FromGitter>
<Blacksmoke16> i suppose
<FromGitter>
<bew> gotta go, some document to write before sleeping (argh..) see ya!
<FromGitter>
<dscottboggs_gitlab> I don't get why `!` can't be defined though... I wouldn't think `def !` would be for the prefix use, I'd think it'd be for like that guy wanted to do, `something.!`. It's obviously already compiler magic. why not have the compiler define a regular function instead of just saying "no"
<FromGitter>
<asterite> @dscottboggs_gitlab `!` can't be overwritten because it affects type flow: `if !a` means that in the `else` branch `a` is truthy. If you could redefine that it wouldn't be possible to know this is always true
<FromGitter>
<dscottboggs_gitlab> I just meant that it seems weird to me that `def !` defines the prefix ! syntax instead of a regular method named `!`
<FromGitter>
<dscottboggs_gitlab> not that I think you should be able to change the meaning of `!a`, that would be terrible lol
<FromGitter>
<dscottboggs_gitlab> or is `!a` the same as `a.!`?
<FromGitter>
<dscottboggs_gitlab> nope `!` just doesn't work. I mean, whatever, there's bigger things to worry about haha
absolutejam has quit [Ping timeout: 248 seconds]
absolutejam has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 246 seconds]
absolutejam1 has joined #crystal-lang
DTZUZO has quit [Ping timeout: 248 seconds]
absolutejam has quit [Ping timeout: 258 seconds]
alex`` has quit [Ping timeout: 245 seconds]
<FromGitter>
<bew> > I just meant that it seems weird to me that `def !` defines the prefix ! syntax instead of a regular method named `!` β @dscottboggs_gitlab i like that :)
<FromGitter>
<dscottboggs_gitlab> :)
<FromGitter>
<bew> but then how to (syntax-wise) define prefix operators like `-` or `~`, maybe a special syntax?
<FromGitter>
<dscottboggs_gitlab> what about `def -self`?
<FromGitter>
<dscottboggs_gitlab> is there no way to differentiate between the prefix and infix `-` syntaxes?
<FromGitter>
<bew> what's the difference?
<FromGitter>
<dscottboggs_gitlab> ` - 5` is "negative 5" but `0 - 5` is "zero minus 5"
<FromGitter>
<bew> oh that, for the method definition, the difference is done without or with an argument
<FromGitter>
<dscottboggs_gitlab> Oh I see
<FromGitter>
<dscottboggs_gitlab> then I don't see any conflicts. You can't do `something.-` because `-` isn't a valid identifier outside of the special operator methods. But doing `something.!` makes sense because methods can already end in in `!`... same for `?`
<FromGitter>
<watzon> Why does `FileUtils` exist? Shouldn't most, if not all, of that functionality be in either `Dir` or `File`?
<FromGitter>
<dscottboggs_gitlab> I've used it before in small scripts
moei has quit [Quit: Leaving...]
<FromGitter>
<dscottboggs_gitlab> Kinda like the global ``` method -- it's not *that* useful to most projects, but someone's using it, and what harm does it do, so why take it out?
<FromGitter>
<watzon> I mean, there's no reason it couldn't stay, but there are a lot of duplicate methods
<FromGitter>
<dscottboggs_gitlab> hm, that's fair
<FromGitter>
<watzon> With the RFC for shrinking the standard library I'd be surprised if they don't want to do something about that
<FromGitter>
<dscottboggs_gitlab> yeah tbh it definitely seems like it could be moved to a crystal-community shard
<FromGitter>
<Blacksmoke16> Pretty sure there is an issue about it
<FromGitter>
<dscottboggs_gitlab> maybe it could get some more features then, and be a more useful
<FromGitter>
<watzon> Honestly if another option were provided I'd never use `!` as a method. Given the methods `Int#!` and `Int#factorial` I'd choose the second every time.
<FromGitter>
<watzon> Just personal preference
<FromGitter>
<watzon> Oh btw, I got a job where I get to use Crystal!
<FromGitter>
<Blacksmoke16> oh/
<FromGitter>
<watzon> Yup, I am now working for NeuraLegion π
<FromGitter>
<watzon> And the best part is they're using some of my personal projects, such as Cadmium. So I'm getting paid to work on my FOSS projects
<FromGitter>
<watzon> Fucking dream come true
<FromGitter>
<Blacksmoke16> nice one!
<FromGitter>
<watzon> Super excited. Right now I'm working on watzon/marionette which will be a port of Puppeteer for Crystal
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter>
<bew> @watzon it's amazing!!! Have fun! Marionette (nice name) looks very nice too ;)
<FromGitter>
<watzon> Thanks! It's going to be a lot of work to get it working correctly. But then I think I'm going to make Arachnid use it exclusively. It'll make for such a powerful crawler.