RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.3 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <drosehn> they are all needed, because they are related to each other.
<FromGitter> <drosehn> a @-variable is an instance variable tied to one instance of some class. Often you'll want to initialize that variable when you create the object. So you'll say `myobj = SomeClass.new(17)`, where the `17` is the initial value you want for some @-variable in that object. So the `initialize` method will pick up the value you specified on `SomeClass.new`, and put that in the @-instance variable.
<FromGitter> <drosehn> Now that's great if the @-variable is never used outside of the object you've created (and certainly that happens). But if you **do** want to reference it or set it from somewhere outside that object, then the object must provide methods which access (or set) the @-variable.
<FromGitter> <drosehn> if you create a `property` for some @-variable, that creates a "getter" and a "setter" method for the variable.
<FromGitter> <drosehn> I hope that helps to show how these things are related to each other.
<miketheman> drosehn: It does, thanks for the explanation. I think I'll try to challenge the assumption that the original implementation uses an `options` hash and merges things around. Instead I'll try using a Config class that gets passed into the initialize
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
<crystal-gh> [crystal] dukex opened pull request #3374: Add HTML.unescape [Closes #3107] (master...add-html-unescape) https://git.io/vPmsn
kulelu88 has quit [Quit: Leaving]
snsei has joined #crystal-lang
snsei has quit []
ragmaanir_ has joined #crystal-lang
ragmaanir has quit [Ping timeout: 244 seconds]
ragmaanir_ has quit [Quit: Leaving]
Philpax has joined #crystal-lang
snsei has joined #crystal-lang
A124 has quit [Read error: Connection reset by peer]
A124 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has quit [Client Quit]
snsei has joined #crystal-lang
<crystal-gh> [crystal] dukex opened pull request #3375: Add `expect` syntax to spec (master...add-expect-syntax) https://git.io/vPm8D
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 264 seconds]
mark_66 has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
<crystal-gh> [crystal] ysbaddaden opened pull request #3376: Add Process.executable_path? to access current executable file path (master...std-process-executable-path) https://git.io/vPmux
sandelius has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philpax has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Client Quit]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
vasilakisfil has joined #crystal-lang
Raimondii has joined #crystal-lang
<vasilakisfil> hey! has anyone spotted any serialization library in crystal ?
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
ponga has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
trapped has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter> <Val> `YAML::Generator` disappeared without any line in `Changelog` until 0.19.2 ?
<FromGitter> <Val> Ok I saw #3353
<DeBot> https://github.com/crystal-lang/crystal/issues/3353 (Bug in round tripping YAML with "*"?)
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #3375: Add `expect` syntax to spec (master...add-expect-syntax) https://git.io/vPm8D
<miketheman> I'm having trouble wrapping my head around how to best write a udpsocket server that gets an unknown amount of data. Ruby has a convenience method on Socket: http://ruby-doc.org/stdlib-2.3.1/libdoc/socket/rdoc/Socket.html#method-c-udp_server_loop
<miketheman> the `.gets` method will either block until `\n` or a predetermined number of bytes
<miketheman> the `.receive` method appears to interact with binary messages
Philpax has quit [Ping timeout: 248 seconds]
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
<asterite> miketheman: I think you can use receive and then create a string out of the slice, or create a string and read into its slice (there's a String.new overload for that)
<miketheman> asterite: I'll look at that, I guess I have to allocate a size of the slice to the max size of the expected message?
<Papierkorb> What's needed to port Crystal to a new operating system? I'd be happy with the BoehmGC already
pawnbox has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
<miketheman> asterite: this appears to work: https://carc.in/#/r/1b7h
<miketheman> (side note, Ruby has `.to_f` to Time.now for higher precision, Crystal doesn't have that yet)
<miketheman> is there any detriment to sizing the slice to much larger, i.e. max udp packet size? `message = Slice(UInt8).new(65_507)`
<miketheman> or would I benefit from moving the `message` declaration outside of the loop?
<miketheman> ah, if I do that I get weird overwriting behaviro
havenwood has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has quit [Changing host]
<miketheman> Anyhow, it looks like it's doing the thing I wanted, thanks @asterite
sandelius has joined #crystal-lang
emancu has quit []
sandelius has quit [Client Quit]
miketheman is now known as miketheman_
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
miketheman_ is now known as miketheman
mark_66 has quit [Remote host closed the connection]
miketheman is now known as miketheman_
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
miketheman_ is now known as miketheman
<leafybasi> I want to reduce an array to an array of named tuples, if I call "reduce([])" I am told to provide a type, "reduce([] of NamedTuple)" says its not specific enough, but "reduce([] of NamedTuple(key: String, value: Int32))" it complains when trying to add a tuple to the array within the block, I'm a little cofnused as to why...
<leafybasi> Sorry reduce an array of strings to an array of named tuples*
<leafybasi> The error is long so I've gisted it: https://gist.github.com/barisbalic/9fe8eec829ca34973be27c651d3f4f4c
<BlaXpirit> leafybasi, are you sure you understand what 'reduce' does?
<BlaXpirit> "reduce to an array" sounds like a paradox to me
<leafybasi> You can reduce to any single value
<leafybasi> My value happens to be a collection
<leafybasi> I could map and flatten, but reduce should allow me to do what I want
<BlaXpirit> please show code and maybe say what you want to do
<leafybasi> Sure thing
<BlaXpirit> leafybasi, well your error shows that you're trying to do Array(Array(T)) << T
<leafybasi> edited, please refresh
pawnbox has quit [Ping timeout: 252 seconds]
<leafybasi> Okay
<leafybasi> I see it, my bad
<leafybasi> Thanks for talking it through BlaXpirit
ponga has quit [Quit: Connection closed for inactivity]
<miketheman> is there a way to control a Fiber? I want a long-lived spawn/loop until a `.stop` message is sent, and am not sure how that might look.
<miketheman> Kind of like Ruby's Thread.kill
<leafybasi> miketheman: if the loop responds to incoming messages you would use channels
<leafybasi> But if it can't be blocked (while waiting) then I'm not sure
<Papierkorb> miketheman: if it has to be a long-running fiber, you could make it check every iteration or so if a "running" bool has become `false`. Later, when Crystal supports threading, you can simply use an AtomicBool instead of a Bool for thread-safety.
pawnbox has joined #crystal-lang
<BlaXpirit> aren't bools atomic anyway
<Papierkorb> It should if you don't care about the memory barrier
jeromegn has quit [Read error: Connection reset by peer]
jeromegn has joined #crystal-lang
<miketheman> it doesn't appear so - since without channels I use `sleep` to control the Fiber's long-life, and this has a jobs max
<miketheman> unless I'm reading it wrong
vasilakisfil has quit [Quit: Konversation terminated!]
vegai has quit [Quit: Lost terminal]
kulelu88 has joined #crystal-lang
pawnbox has quit [Quit: gotta go guys.]
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
sandelius has joined #crystal-lang
ruby_ has joined #crystal-lang
ruby_ has quit [Client Quit]
pawnbox has quit [Remote host closed the connection]
<crystal-gh> [crystal] ysbaddaden opened pull request #3379: Fix: use __iconv on FreeBSD to skip invalid bytes (master...core-iconv-freebsd-skip) https://git.io/vPOIt
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPOY2
<crystal-gh> crystal/master 4733360 Ary Borenszweig: Compiler: fixed crash related to cast between unions having tuples. Fixes #3377
<crystal-gh> [crystal] faustinoaq opened pull request #3380: Fix named tuple (master...patch-1) https://git.io/vPO3p
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
matp has quit [Quit: ZZzzzZz...]
matp has joined #crystal-lang
<travis-ci> crystal-lang/crystal#4733360 (master - Compiler: fixed crash related to cast between unions having tuples. Fixes #3377): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/164753280
<DeBot> https://github.com/crystal-lang/crystal/issues/3377 (Nil assertion failed on cast between union types)
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 248 seconds]
snsei_ has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
bjmllr has quit [Quit: WeeChat 1.0.1]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjmllr has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vPOEY
<crystal-gh> crystal/master a8eef9b Faustino Aguilar: Fix named tuple (#3380)
<FromGitter> <anicholson> potentially silly question: when I use `puts` in my programs, who's the receiver of that message, and what's its type?
<FromGitter> <anicholson> oh I see, they belong inside the Top-Level Namespace
<FromGitter> <anicholson> that confuses this Rubyist ;)
<FromGitter> <anicholson> especially when the docs say "Everything is an Object"!
<FromGitter> <anicholson> Lies! :)
<travis-ci> crystal-lang/crystal#a8eef9b (master - Fix named tuple (#3380)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/164779610
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 248 seconds]