mark_66 has quit [Remote host closed the connection]
<miketheman>
asterite: if you're around, I'd appreciate a bit of help here
maxpowa has joined #crystal-lang
<vegai>
hey, musl support in 0.16! Woo!
<vegai>
does anyone sell crystal stickers?
<vegai>
any plans on making crystal compile against llvm 3.7, by the way?
<asie>
musl support? woo indeed!
ruslux has joined #crystal-lang
<ruslux>
Hello! Can I prevent downcasting from "alias Document = Hash(String, Type)" to "Hash(String, String)" when it passed to restricted function arg like "def foo(param : Document)"?
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/vwxaC
<crystal-gh>
crystal/master 31f60d8 Ary Borenszweig: Number: added Number::Primitive alias
<crystal-gh>
crystal/master f25f270 Ary Borenszweig: Removed `Char#ord` primitive from compiler's code, and prepared the terrain to move more primtiives to Crystal code.
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
pabs has quit [Ping timeout: 264 seconds]
rtl has quit [Remote host closed the connection]
rtl has joined #crystal-lang
emancu has quit []
pabs has joined #crystal-lang
<asterite>
vegai: the reason is that this is a call with named arguments: `foo(x: 1, y: 2)`. This is a call with type declarations (useful for macros): `record Point, x : Int32, y : Int32`. The space is what distinguishes them. We chose to use a space too in method declarations, because these are really type declarations. If we allow omitting the space then it'll be easier to mix the two concepts. So it's purely a decision of ours, not a limitation i
<asterite>
n, say, the parser or the type inference
<vegai>
ah
<vegai>
would the pythonic = worked better with named arguments, what do you think?
<BlaXpirit>
vegai, do you understand what happens here?
<vegai>
x gets assigned 5 and that assignments returns 5?
<BlaXpirit>
well yes
<vegai>
I mean the expression returns 5
<travis-ci>
crystal-lang/crystal#f25f270 (master - Removed `Char#ord` primitive from compiler's code, and prepared the terrain to move more primtiives to Crystal code.): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/128338957
<vegai>
BlaXpirit: I suppose python restricts the usage of "=" in many places
<BlaXpirit>
sometimes i hate assignment not being an expression
<BlaXpirit>
also i hate '=' being assignment
<vegai>
using the return value of an assignment hardly ever leads to better code in my opinion
ruslux has joined #crystal-lang
<BlaXpirit>
vegai, in crystal it's especially usefulk
<asterite>
On that matter, we could disallow assignment inside calls, and use `x=foo`. In any case, either `=` or `:` will have their meaning overloaded :/
<asterite>
There's also the thing that we might add named tuples, with a syntax like {x: 1, y: 2}. We'd have to use {x=1, y=2}... well, which doesn't look that bad, actually :-)
<BlaXpirit>
nah just forget about this
<BlaXpirit>
what about round brackets for tuples though?
<asterite>
You mean <1, 2, 3>, or (1, 2, 3) ?
<BlaXpirit>
asterite, I mean (1,2,3). '<' doesn't look round to me
<asterite>
Hehe, yeah, I noticed too late but there's no way to delete IRC messages :-(
<asterite>
Mmm...
<asterite>
It was considered, there's even an open issue for that
<asterite>
The main issue is this: (Int32, Int32) -> Int3
<asterite>
Is that a function with a tuple as an argument, or with two arguments?
<asterite>
In Swift for example, where tuples are written with parentheses, it's a function with two arguments
<asterite>
You'd have to do: ((Int32, Int32)) -> Int32
<asterite>
I guess that's not that bad... but... with {...} there's no such problem
<BlaXpirit>
it's not bad if it actually worked, but crystal can't have (item) to be a tuple
ruslux has quit [Ping timeout: 276 seconds]
ylluminate has joined #crystal-lang
jsaak has joined #crystal-lang
<jsaak>
hello i have trouble reading from a file, can someoeon point me out what i am doing wrong?
<RX14>
maybe ebcause it's from another, complex context
<RX14>
yeah
<RX14>
thats it
<RX14>
another fiber could change file
<BlaXpirit>
uh no..?
<RX14>
so it's like a class variable
<RX14>
i think
<RX14>
idk
<BlaXpirit>
yeah you're probably right
<vegai>
BlaXpirit: ah, right
<RX14>
anyway
<RX14>
power_assert.cr will be "fun" to fix
<BlaXpirit>
jsaak, so when you're writing `if file` inside a fiber who said someone isn't going to assign `file = nil` in between
<BlaXpirit>
RX14, wha are you the author of power_assert?
<RX14>
no
<RX14>
the author is basically dead
<RX14>
so I have a form
<RX14>
fork*
<jsaak>
BlaXpirit: who on earth could do that? :)
<jsaak>
ohh you are right sorry
<RX14>
jsaak, thats what people said about C rces
<BlaXpirit>
RX14, >29 days ago ?
<RX14>
oh he updated it
<RX14>
there are unanswered PRs
<RX14>
and shite
<jsaak>
but i have a fil.nil? check inside the fiber too
Philpax has quit [Ping timeout: 252 seconds]
<BlaXpirit>
jsaak, I understand but what if somone changes it AFTER you checked?
<BlaXpirit>
by someone i mean some other piece of code
<jsaak>
it is not possible since it is single threaded, no?
<jsaak>
but let assume you are right, how to read from a file then?
<BlaXpirit>
jsaak, current crystal concurrency is worst of both worlds
<BlaXpirit>
it is singlethreaded but execution can switch semi-randomly
<BlaXpirit>
when any code happens to yield
Philpax has joined #crystal-lang
<BlaXpirit>
no, saying "yield" here is misleading, because the "yield" keyword is not used
<BlaXpirit>
jsaak, the whole point of this concurrency is that you do not share any resources
<RX14>
BlaXpirit, so how does crystal work out when a variable can escape to another thread?
<RX14>
it seems like it must be able to
<BlaXpirit>
you use channels to pass datga
<BlaXpirit>
it's really unfortunate that crystal took Go's idiotic ideas but what can you do
<jsaak>
crystals current state of concurrency is confuding for me :)
<BlaXpirit>
Crystal can't use Python's great ideas because it doesn't have coroutines in the first palce
<jsaak>
and no Fibers either?
<BlaXpirit>
jsaak, the gist of it is. FOR NOW it runs in 1 thread, it has almost all the problems of normal threaded programming, and you shouldn't use the same resource from different fibers
<jsaak>
"To achieve concurrency, Crystal has fibers"
<Netfeed>
it's fine, i can use ruby, but compiled crystal was so much faster :)
<RX14>
that method should work
<Netfeed>
alright, thanks, i'll take a look
<RX14>
in most cases
TheLemonMan has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
ruslux has joined #crystal-lang
mroth has quit [Ping timeout: 244 seconds]
mroth_ has joined #crystal-lang
jwaldrip_ has joined #crystal-lang
jwaldrip has quit [Ping timeout: 240 seconds]
jwaldrip_ is now known as jwaldrip
mroth_ has quit [Ping timeout: 240 seconds]
mroth_ has joined #crystal-lang
maxpowa has quit [Quit: Ahh! My head is on fire!]
maxpowa has joined #crystal-lang
yllumina_ has joined #crystal-lang
ylluminate has quit [Ping timeout: 260 seconds]
ylluminate has joined #crystal-lang
yllumina_ has quit [Ping timeout: 246 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
nakilon has joined #crystal-lang
fowlduck has joined #crystal-lang
nakilon_ has joined #crystal-lang
<fowlduck>
can crystal programs be compiled to standalone binaries, similar to go?
nakilon has quit [Ping timeout: 252 seconds]
<RX14>
fowlduck, how standalone?
<RX14>
like, there's only minimal linking required
<RX14>
it's not like every library is dynamically linked with most C/C++ programs
<fowlduck>
does crystal need to be installed on the system the binary is on in order to run?
<RX14>
nope
<fowlduck>
ok, cool
<RX14>
it needs some basically libraries that most systems have though
<tilpner>
No, it shouldn't be required, though you'll need libgc, libpcre and a couple of other things.
<RX14>
oh
<RX14>
libgc
<RX14>
I forgot about that
<tilpner>
They're comparably common though, so they're either preinstalled or available through your distros package manager.
<RX14>
libgc isn't as common as the rest though
<tilpner>
I wish they'd "just" remove libgc as a dependency. :s
<fowlduck>
Is there any way to statically compile it? I know a fair number of developers looking for something rubyish that can compile to standalone binaries for little command-line tools
<fowlduck>
I don't know enough to even know if what I'm asking makes sense
<Netfeed>
crystal build?
<RX14>
Netfeed, ?
<Netfeed>
wouldn't that do it?
<RX14>
it compils them
<RX14>
but there's still a runtime dep on libgc
<tilpner>
Yes, it will statically compile them, but link them dynamically. c.c
<Netfeed>
RX14: ah, true
<RX14>
everything in crystal is statically compiled
<RX14>
but the GC is written in C++
<RX14>
(or c can't remember)
<RX14>
and is dynamically lniked
<RX14>
you jmight be able to statically link it
<RX14>
i'm 100% not sure
<RX14>
linking is magic to me
pawnbox has joined #crystal-lang
<fowlduck>
me, too
<fowlduck>
my coworker pointed out that 0.16.0 was released
<fowlduck>
and that crystal is on its way to fixing the compilation issues due to inference across large projects
pawnbox has quit [Ping timeout: 240 seconds]
<Netfeed>
what's the best way of creating a new hash (or modify an existing) so i can run a function on each value in the hash? i'm feeling pretty stupid right now, but the best solution i can come up with right now is something like Hash.zip(hsh.keys, hsh.keys.map { |k| some_func(hsh[k] }) and that seems pretty wrong to me
<RX14>
doesn't hash.map exist?
<RX14>
oh, nope wtf
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vwpGF
<crystal-gh>
crystal/master e9a73cb Ary Borenszweig: Compiler: moved all primitive declarations to Crystal code