rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
Rakko has quit [Quit: Leaving]
jenrzzz has joined #ruby
Itsame1 has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
dionysus69 has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rdash has joined #ruby
cnsvc has quit [Quit: WeeChat 2.9]
jenrzzz has quit [Ping timeout: 240 seconds]
rdash has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
alexherbo2_ has joined #ruby
rdash has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rdash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
Itsame1 has quit [Quit: Itsame1]
rose_nd_ash has quit [Remote host closed the connection]
lxsameer has joined #ruby
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
nicholaslyang has joined #ruby
rose_nd_ash has joined #ruby
alexherbo2_ has quit [Ping timeout: 256 seconds]
rose_nd_ash has quit [Remote host closed the connection]
alexherbo2 has quit [Ping timeout: 240 seconds]
rose_nd_ash has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
rose_nd_ash has quit [Ping timeout: 246 seconds]
nicholaslyang has quit [Client Quit]
rose_nd_ash has joined #ruby
dionysus69 has joined #ruby
alexherbo2 has joined #ruby
rose_nd_ash has quit [Ping timeout: 264 seconds]
imode has quit [Ping timeout: 260 seconds]
chalkmonster has joined #ruby
BuildTheRobots has quit [Changing host]
BuildTheRobots has joined #ruby
BuildTheRobots has joined #ruby
postmodern has joined #ruby
bocaneri has quit [Ping timeout: 246 seconds]
bocaneri has joined #ruby
bocaneri has quit [Remote host closed the connection]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
ruurd has joined #ruby
ur5us has joined #ruby
sepp2k has left #ruby ["Kicked by @appservice-irc:matrix.org : Idle for 30+ days"]
jenrzzz has joined #ruby
rose_nd_ash has joined #ruby
alexherbo24 has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
sphex has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
TzilTzal has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
tpanarch1st has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
sphex has joined #ruby
TzilTzal has joined #ruby
nicholaslyang has joined #ruby
cb` has quit [Remote host closed the connection]
rose_nd_ash has quit [Remote host closed the connection]
cb` has joined #ruby
rose_nd_ash has joined #ruby
nicholaslyang has quit [Client Quit]
_whitelogger has joined #ruby
schne1der has quit [Ping timeout: 240 seconds]
GodFather has quit [Ping timeout: 256 seconds]
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
tpanarch1st has quit [Ping timeout: 240 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
iNs_ has quit [Remote host closed the connection]
iNs has joined #ruby
roadt_ has quit [Ping timeout: 256 seconds]
roadt_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
markoong has joined #ruby
jenrzzz has joined #ruby
MadLamb has joined #ruby
<MadLamb>
how can I rename a object property when serializing it with as_json? lets say I want title to be called name?
jenrzzz has quit [Ping timeout: 260 seconds]
sameerynho has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
sgen has joined #ruby
leitz has joined #ruby
jenrzzz has joined #ruby
tankf33der has left #ruby [#ruby]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
nicholaslyang has joined #ruby
ajunior has joined #ruby
nicholaslyang has quit [Client Quit]
sgen has quit [Ping timeout: 246 seconds]
drincruz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
noctux has joined #ruby
<noctux>
Hello, I've got a small issue with ruby that I would like to understand. Here is a minimal reproducer of the problem: https://paste.xinu.at/m-7DSVbe/ When I install the 'dhallish' gem alongside rubocop, I get the error "NameError: uninitialized constant AST" whenever I try to run robocop. However, the constant 'AST' does not appear in the dhallish-gem at all (it has some other Classes whose name
<noctux>
start with ASTN..., but those seem to be correctly namespaced to me within an Dhallish:: module anyways...) Can someone enlighten me what goes wrong there during import-resolution? is there a way to make ruby more verbose during that phase? my rubyversion is "ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]" in case that matters...
<noctux>
as said in the gemfile: when I comment the "gem 'dhallish'" line, all starts to work fine
jenrzzz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
ajunior has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 240 seconds]
dnadev2 has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
<noctux>
aaah, I found it
jenrzzz has joined #ruby
<noctux>
so 'require' in ruby is exclusively filename based, so two gems having file 'lib/ast.rb' are bound to clash?
ajunior has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
infinityfye has joined #ruby
zapata has quit [Quit: WeeChat 2.9]
fercell has joined #ruby
Technodrome has quit [Ping timeout: 256 seconds]
sameerynho has quit [Ping timeout: 256 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
MrCrackPot has joined #ruby
drincruz has joined #ruby
coniptor has quit [Ping timeout: 246 seconds]
sameerynho has joined #ruby
infinityfye has quit [Quit: Leaving]
sameerynho has quit [Ping timeout: 272 seconds]
coniptor has joined #ruby
kimberky` has joined #ruby
ldepandis has joined #ruby
kimberly`` has joined #ruby
kimberly`` has quit [Max SendQ exceeded]
dnadev2 has quit [Ping timeout: 240 seconds]
kimberky` has quit [Ping timeout: 264 seconds]
sameerynho has joined #ruby
ajunior has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kimberly`` has joined #ruby
kimberly`` has quit [Max SendQ exceeded]
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
SeepingN has joined #ruby
kimberly`` has joined #ruby
kimberly`` has quit [Max SendQ exceeded]
rose_nd_ash has quit [Read error: Connection reset by peer]
rose_nd_ash has joined #ruby
prescilla22 has joined #ruby
prescilla22 has quit [Max SendQ exceeded]
Emmanuel_ChanelW has quit [Quit: Leaving]
prescilla22 has joined #ruby
prescilla22 has quit [Max SendQ exceeded]
prescilla22 has joined #ruby
prescilla22 has quit [Max SendQ exceeded]
schne1der has joined #ruby
Sina has joined #ruby
<leitz>
noctux, they shouldn't clash, as the gem should have it's own namespace.
clive has joined #ruby
<leitz>
In my_gem1, a "require 'lib/ast.rb' " should not impact my_gem2's " require 'lib/ast.rb' ".
<leitz>
Unless I'm totally confused, which is always possible.
TomyWork has joined #ruby
clive has quit [Quit: Leaving]
dnadev2 has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
Itsame1 has joined #ruby
rose_nd_ash has joined #ruby
ujjain2 has joined #ruby
greengriminal has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
sameerynho has quit [Ping timeout: 264 seconds]
rose_nd_ash has joined #ruby
stryek has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
zapata has joined #ruby
prestorium has joined #ruby
renich has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akem_ has joined #ruby
sameerynho has joined #ruby
akem has quit [Ping timeout: 260 seconds]
akem_ has quit [Ping timeout: 264 seconds]
<phaul>
how do we feel about the term 'iterator' in the context of Ruby? I was reading readit, and there is a tutorial that exaplains how each is an iterator. also there was some reference to codeacademy where they call block arguments place holders. I prefer teaching blocks, Enumerable and Enumerator. Personally I don't like the iterator / placeholder explanation - terms
dnadev2 has quit [Quit: Leaving]
MrCrackPot has quit [Quit: Leaving]
<phaul>
I mean reddit :)
dviola has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
ujjain2 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renich has quit [Remote host closed the connection]
sameerynho has quit [Ping timeout: 264 seconds]
ldepandis has joined #ruby
DaRock has quit [Ping timeout: 246 seconds]
<apotheon>
phaul: I've never encountered that "placeholder" phrasing, but it's technically true that "each" is an iterator block. It just happens to be an Enumerable iterator block.
<apotheon>
file in ARGV.
<apotheon>
see:
<apotheon>
Returns an enumerator which iterates over each line (separated by
<apotheon>
(from ri)
<apotheon>
sep, which defaults to your platform's newline character) of each
<apotheon>
The value of referring to it as an "iterator" is that the term "iterator" is something experienced developers are likely to have encountered, and to understand, so they can quickly grasp a concept related to how it works and should be used.
sameerynho has joined #ruby
<apotheon>
In a way, referring to Enumerable is an implementation detail (though an important detail for understanding beyond the most basic beginning concepts, of course).
rippa has joined #ruby
nyuszika7h has quit [Quit: ZNC 1.8.1+deb1~bpo10+1 - https://znc.in]
nyuszika7h has joined #ruby
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Ping timeout: 246 seconds]
GodFather has joined #ruby
fercell has quit [Quit: WeeChat 2.8]
<leitz>
Iterator is a GoF pattern.
<leitz>
Storms in the area, back in a bit.
leitz has quit [Quit: Leaving]
<apotheon>
Yeah, Ruby is an excellent demonstration of the principle that design patterns are indications that something is missing from your programming language and its standard library.
davispuh has joined #ruby
cthu| has joined #ruby
<apotheon>
. . . in that Ruby doesn't require implementing the iterator pattern or the dependency injection pattern, among other patterns.
<phaul>
I hear you. I had a strong opinion on this but now I know less so
<apotheon>
In Ruby, you just "do it". In Java, both these things require a bunch of boilerplate code.
<phaul>
As long as people understand that as afarr as the language goes each is "just a method" like any other I guess i don't mind.
Itsame1 has quit [Quit: Itsame1]
<phaul>
I think to me the wayy people describe iterators is more like a lannguage construct rather than a design pattern. But maybe Im reading too much into those explanations
GodFather has quit [Ping timeout: 244 seconds]
<apotheon>
Well . . . in Ruby, it *is* a language construct.
<apotheon>
(as are all core language methods)
prestorium has quit [Ping timeout: 264 seconds]
<phaul>
It is a method. right? I consider concrete language features languages construct. The way you described it to me sounded like iterator is the airy concept when you use a block passed to a method for the puurpose of iteration. That's hardly a language construct
<phaul>
to me. that is
<phaul>
Like I guess File.open { .. } is not ann iterator as it's not iterating?
postmodern has quit [Quit: Leaving]
ashley^ has joined #ruby
prestorium has joined #ruby
prestorium has quit [Client Quit]
ashley^ has quit [Read error: Connection reset by peer]
TomyWork has quit [Remote host closed the connection]
dionysus69 has quit [Remote host closed the connection]
<al2o3-cr>
all blocks are iterators.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul>
okay. So would you say, blocks are the language construct that implements the design/pattern concept 'iterator' ?
<apotheon>
Does an idempotent Ruby block count as an "iterator"?
<apotheon>
phaul: in a way, yeah
schne1der has quit [Ping timeout: 264 seconds]
<apotheon>
One can implement a block-handling method that doesn't iterate over a series.
<phaul>
that is quite common use of blocks too
orbyt_ has joined #ruby
<apotheon>
A block is basically just syntactic sugar for handling a one-off callback.
<apotheon>
I do kinda wish Ruby hadn't used the term "block" for this, though.
<apotheon>
It gets confusing, given the historical uses of the term "block" in reference to source code.
<phaul>
It's basically a closure. What's your preferred way of calling it?
<apotheon>
In this case, "historical" doesn't even necessarily mean "in the past"; it also applies in the present.
<al2o3-cr>
phaul: it's a closure.
roadt_ has quit [Ping timeout: 240 seconds]
<apotheon>
It's a closure when it has a block variable. I'd have to look at the implementation to see if it's a technical closure all the time.
<apotheon>
I don't recall for sure, the last time I looked at the implementation of the block construct in Ruby, and even then it was so long ago that it might be a very different thing now.
<apotheon>
It is definitely a callback, though.
<phaul>
Anyway I accept that that's what people call iterators, but as we pointed out sometimes it has nothing to do with iterating so the name is a bit misleading
<al2o3-cr>
that's why block_given? is synonymous with iterator?
<al2o3-cr>
if yields values or not.
<apotheon>
The each method *is* an iterator. Not all methods that take blocks as arguments iterate, but each does.
<phaul>
prly I was mislead by old c++ memories where iterator was an object with an interface similar to our enumerator
<al2o3-cr>
each is definitely an iterator method.
<apotheon>
(speaking of a general, Ruby-nonspecific use of the term "iterate")
<al2o3-cr>
but jargon sucks sometimes.
<apotheon>
yep
<apotheon>
Actually, technically, I guess each is definitely an iterator method, because when it doesn't iterate it returns an iterator.
<apotheon>
. . . because Ruby is magical that way.
<phaul>
nope
<phaul>
it returns an Enumerator
<phaul>
please not mix that in the picture
<apotheon>
An Enumerator is an iterator.
<phaul>
:)
<al2o3-cr>
apotheon: not quite.
<apotheon>
Oh? How isn't it?
<phaul>
well, we just established that iterators were blocks
roadt_ has joined #ruby
<apotheon>
Ruby-nonspecific "iterator"
<al2o3-cr>
well, in the sense, yes.
<al2o3-cr>
*that
<apotheon>
jargon
<apotheon>
damn it
<al2o3-cr>
yep.
andremedeiros has quit [Quit: ZNC 1.8.1 - https://znc.in]
<al2o3-cr>
phaul: they still are.
czrrrr has joined #ruby
<czrrrr>
hui
<phaul>
I guess - I know quite well what these things mean and how they work in Ruby, what Im asking to establish is the meaning of the iterator terminology
<apotheon>
I'm not happy with my previous use of the term "series".
<apotheon>
(because mathematics jargon)
<phaul>
So everything is an iterator, blocks, Enumerators, but now we are unsure about blocks?
<apotheon>
I use many languages, not just Ruby, and I think perhaps Ruby's greatest flaw is that its jargon interferes with the ability to communicate about programming concepts with non-Rubyist programmers.
<al2o3-cr>
phaul: no, blocks are definitely still iterators.
<phaul>
okay.
<apotheon>
al2o3-cr: Are you saying it's an "iterator" strictly because of the iterator? method?
* baweaver
sips tea
<phaul>
and some methods like each ?
<al2o3-cr>
apotheon: no because they're closures.
mynameisdebian has joined #ruby
<apotheon>
Closures are not always iterators, and whether blocks are *always* closures is, to me at least, still up for debate.
andremedeiros has joined #ruby
<apotheon>
. . . unless you claim there's a Ruby-specific term "closure" that means they're always "iterators".
* baweaver
reads back
<phaul>
:D hi baweaver
<al2o3-cr>
o/ baweaver
<apotheon>
A closure is just a function/procedure/whatever that binds (closes over) its scope context.
<baweaver>
I mean as long as one accepts it can be rebound depending on execution.
<apotheon>
It doesn't have to iterate at all, and in fact outside of Ruby it's likely that most closures don't function (pun intended) as iterators.
<baweaver>
see: instance_eval, et al
<apotheon>
It seems likely to me, anyway.
<baweaver>
Never really liked the term block, would prefer block function or function honestly.
<al2o3-cr>
apotheon: each doesn't have to iterate if there's no value to iterate.
<apotheon>
baweaver: yeah
<al2o3-cr>
it's still an iterator like blocks are.
<baweaver>
You'll notice my code has &fn everywhere if I can get away with it
<apotheon>
al2o3-cr: Define "iterator" in that sentence.
<apotheon>
baweaver: amusing
<al2o3-cr>
it iterates over its collection/container or whatever.
<baweaver>
but I tend to go standard block otherwise if interacting with others.
<al2o3-cr>
baweaver: i use &anon
<apotheon>
baweaver:
<apotheon>
16:31 < apotheon> I do kinda wish Ruby hadn't used the term "block" for this, though.
<apotheon>
16:31 < apotheon> It gets confusing, given the historical uses of the term "block" in reference to source code.
<apotheon>
baweaver: . . . so we're in agreement about the unfortunate use of the term "block" in Ruby (which I think it inherited from Smalltalk).
<al2o3-cr>
apotheon: why is makes sense. { block of code }
<baweaver>
A block is just a function, not following how they're iterators unless they're supplied to an iterable entity like Enumerator
<apotheon>
al2o3-cr: Define "iterates over", considering I don't think every single block actually contains any (generic, Ruby-nonspecific) iteration code in the implementation of the construct.
<baweaver>
I mean each is essentially: def each(&block) return Enumerator.new(self) unless block_given?; ... end
<al2o3-cr>
apotheon: well, no if nothing is yielded to the block.
<al2o3-cr>
it's still an iterator though.
<apotheon>
How is it still an iterator?
<apotheon>
You haven't clarified what definition of "iterator" includes things that offer no iteration facilities.
<baweaver>
each is an iterator, blocks I'm still not following.
<baweaver>
It'd either return an Enumerator or yield through collection items
<al2o3-cr>
apotheon: ok, agree to disagree.
<baweaver>
Are you referring to block functions themselves always being iterators?
<baweaver>
Because that'd be inaccurate
<apotheon>
baweaver: I'd yield (pun intended) on each, because it either produces iteration behavior or returns an object with built-in iteration behavior (i.e., it either acts as an iterating object or produces one, and something that iterates is an "iterator", while something that returns an iterator could likewise beconsidered an "iterator method" that, in short form, could be called an "iterator").
<baweaver>
Iterable entity then
<apotheon>
It's non-Enumerator block-handling methods, and blocks that don't have anything to do with iteration, that I think aren't really sensible to call "iterators".
<baweaver>
Though it's pretty rare people use each without a block so not a common subject
<apotheon>
baweaver: I think you and I are on the same page, and just explaining in varying ways.
<baweaver>
That I'd agree with
<apotheon>
. . . but a block *in and of itself* is just a callback, as far as I'm aware.
<baweaver>
block, callback, function, lambda, proc, whatever it happens to be called today
<apotheon>
It is a function passed to a receiver.
<phaul>
seems terminology is quite hard. btw apotheon you changed your mind about blocks since we started discussing :)
<baweaver>
+1 delta
<apotheon>
phaul: How so?
* baweaver
needs to get off reddit
romanlevin333236 has quit [Ping timeout: 256 seconds]
<apotheon>
I'm playing fast-and-loose with the term "function", as that can have a strict definition to which not all blocks might conform, I think.
nicholaslyang has joined #ruby
<apotheon>
I'd have to think about it more, though, and I don't want to. That's a whole other subject.
<apotheon>
baweaver: Yes, get off reddit.
dviola has quit [Ping timeout: 260 seconds]
<apotheon>
baweaver: Get sucked into an IRC discussion of jargon terms, instead.
nicholaslyang has quit [Client Quit]
<apotheon>
So . . . a Ruby block is executable code passed as a parameter to other code, just to be clear about it.
<apotheon>
I don't think I want to read a full log of the entire conversation to try to figure out what you mean.
<phaul>
ah I thought I highlighted the relevant 3 lines
<phaul>
(16:24)
<al2o3-cr>
phaul: i think apotheon was responding to me.
<apotheon>
I did notice that I used some incautious phrasing at one point.
<apotheon>
No, the "figure out what you mean" was about phaul saying I changed my mind.
<apotheon>
. . . and providing a log.
<apotheon>
phaul: I still don't get what you're saying about me changing my mind, though.
<phaul>
that is the best I can do, the lines ire barely highlighted
<phaul>
barely visible, but I gave you a timestamp
<apotheon>
phaul: At 16:24 in that log, I asked whether an idempotent Ruby block counts as an "iterator".
<apotheon>
Did I say something later that contradicts the implications of that?
<phaul>
before that line and after that line
GodFather has joined #ruby
<phaul>
was your answer phaul: in a way yes not actually meant?
<apotheon>
Did I say something that contradicts the idea that a language construct implementing the "iterator" pattern is "in a way" an iterator?
<apotheon>
If so, I should re-examine what I said to figure out if I have some inconsistent thinking on the matter.
<apotheon>
What's the more recent statement of mine you'd use to show that I changed my mind?
<al2o3-cr>
all methods in ruby take an implicit block
<phaul>
apotheon: I mean referring to blocks. blocks being iterator or them implementing the iterator pattern. That was the question.
<havenwood>
An iterator iterates. Blocks don't iterate. Procs, lambdas, closures, anonymous functions or block? Depends on the language but same family. Why does Ruby have blocks? It seems like a recognition that an object is too much overhead for this family in a common case, worthy of some sugar.
skape has joined #ruby
<havenwood>
I prefer pragmatic for definitions like coder, programmer, iterator, enumerator, etc.
<al2o3-cr>
havenwood: not true, all block iterate over their values.
<havenwood>
al2o3-cr: Is a single step walking?
<al2o3-cr>
havenwood: sequentiall yes, just like any other iterator.
<apotheon>
phaul: I was trying to figure out whether someone thought an idempotent Ruby block counted as an iterator. I believed it does not count as an iterator. My "in a way, yeah" was saying, of "blocks are the language construct that implements the design/pattern concept 'iterator'", that block handling is used to implement the iterator design pattern, but not that this is *all* one uses blocks to
<apotheon>
implement.
<apotheon>
For instance, the module language construct is used to implement mixins, but that's not the only thing modules are used to implement.
<havenwood>
al2o3-cr: So you'd call a block a single iteration? An iteration over what?
<al2o3-cr>
havenwood: all yielded values, whether that be 0 or 6 million.
<havenwood>
A block commonly provide the function for each step of iteration, but it itself isn't the iteration.
<apotheon>
If "all blocks iterate over their values", then *all units of code* similarly "iterate over their values", to the extent they "have" values.
<phaul>
apotheon: I see what you mean
<al2o3-cr>
apotheon: with a closed scope.
<al2o3-cr>
*within.
<apotheon>
so every method in Ruby is an iterator, every class is an iterator, and every Logo procedure is an iterator.
<apotheon>
s/.$//
<apotheon>
I guess, by that definition, every C file is an iterator.
<havenwood>
Only things that iterate are iterators.
<al2o3-cr>
nope, but blocks most definitely are.
<apotheon>
havenwood: According to what al2o3-cr said about all units of code "with a closed scope" iterates.
dviola has joined #ruby
<apotheon>
Oh, wait, "closed scope". I think al2o3-cr means closures, there, not a "scope" that is "closed" in that it is limited (as scopes are, by definition).
<havenwood>
A block doesn't iterate any more than a function iterates.
<havenwood>
I don't see it.
<apotheon>
. . . but no proof has been offered that Ruby blocks all close over their scopes.
<apotheon>
It seems havenwood is on the same page as baweaver and me.
<havenwood>
I guess i'd say my shoes don't walk. That said, they're involved in each step, so maybe poetically.
<apotheon>
right
<apotheon>
I'd buy that.
<baweaver>
Considering the existence of rebinding to a context using binding it's... interesting
<apotheon>
. . . having written arguably poetic things in the past.
<havenwood>
Blocks are involved in each step of iteration of an Enumerator, but they themselves don't iterate.
<havenwood>
Pedantic point maybe, but words...
<baweaver>
I mean I can see how one would see it as that, but it's being a bit obtuse for the sake of a thought experiment
<apotheon>
havenwood: It's an important point, I think, but then "pedantic" just means "having the quality of teaching", or something like that, so I guess calling it "pedantic" doesn't technically devalue it.
czrrrr has quit [K-Lined]
<havenwood>
apotheon: My girlfriend and I only allow each other one pedantry per day. We're both wary to use it too early.
<havenwood>
At work I have no such constraint. Muahahahhaa.
<baweaver>
That explains a lot of our bar outings then havenwood
<havenwood>
Hah
GodFather has quit [Read error: No route to host]
dviola has left #ruby [#ruby]
dviola has joined #ruby
lalitmee has joined #ruby
lalitmee has quit [Remote host closed the connection]
lalitmee has joined #ruby
<apotheon>
My current take is that all Ruby blocks™ are callbacks, most of them in practice are closures (but not all, probably, unless there's something funky going on in implementation), blocks™ implement an iteration for Enumerable methods that operate as, or return, iteration units (and thus might reasonably be called "iterators"), and that blocks™ implement the iterator pattern as fully as they
<apotheon>
Did I forget anything?
<apotheon>
reasonably can while still being generically useful constructs.
romanlevin333236 has joined #ruby
<havenwood>
apotheon: Callback isn't the word I'd use.
<apotheon>
There were a lot of terms thrown around that were specific points of dispute or definitional analysis.
<apotheon>
havenwood: Why not?
lalitmee has quit [Remote host closed the connection]
<apotheon>
A callback is a "function" (I'll leave that fuzzy for now) that is passed as a parameter to another "function".
<al2o3-cr>
apotheon: you can use block for a callback if you save it to a variable.
<havenwood>
but then it's an object, proc or lambda
<phaul>
we said (you said) the returned Enumertor (when no block is given) is also called an iterator
<apotheon>
al2o3-cr: You don't have to save a unit of code to a variable for it to act as a callback.
lalitmee has joined #ruby
<apotheon>
. . . or, alternatively, one could say it is "saved to a variable" when the block-as-argument gets assigned to a parameter variable.
<phaul>
we also said at some point that methods like #each are also called iterators
<apotheon>
. . . which it effectively does, as an implicit variable, on which "yield" operates.
lalitmee has quit [Remote host closed the connection]
<al2o3-cr>
apotheon: you've lost me dude!
<apotheon>
phaul: Yeah, I think that works.
<apotheon>
I feel like some participants in this discussion might be unfamiliar with the uses of these terms outside of Ruby culture, but I'm not sure.
* baweaver
definitely uses more than just ruby
<havenwood>
apotheon: I think of callback as a function passed to another function, to be "called back." Callback isn't a hill I'd die on though, since it's pretty nebulous in that many langs have variations.
adu has joined #ruby
rose_nd_ash has joined #ruby
<apotheon>
havenwood: In what context is a Ruby block™ not that?
<baweaver>
yield is a call back though
<apotheon>
Yield is the call back to the function passed to the function in which one calls yield.
<baweaver>
or call is literally a call back
<al2o3-cr>
passing message passing recv <- message this is why we have lambdas and block. one can't do def foo(x) def bar(x) x * 2 end end
<baweaver>
that's a mouthful
<apotheon>
In other words, yield calls back to the callback.
<baweaver>
I mean that's valid Ruby, though it does odd things
<al2o3-cr>
baweaver: sure.
<baweaver>
and to be fair I've yet to see anyone do that in prod and have a passable reason for doing so
<baweaver>
The meta-ones serve as distilled versions of the previous ones
<baweaver>
So once I get to yearly review my quarterly notes are _real_ handy
chalkmonster has quit [Quit: WeeChat 2.9]
BSaboia has joined #ruby
whathappens has joined #ruby
nicholaslyang has joined #ruby
<apotheon>
baweaver: Do you maintain a set of blank-page books for this?
<baweaver>
Google doc
<baweaver>
I keep it stupidly simple
<apotheon>
baweaver: Is it a separate doc per day, per week, et cetera?
<baweaver>
One doc
chalkmonster has joined #ruby
<apotheon>
. . . so it's one doc that contains several years of notes from daily, weekly, et cetera, notes?
nicholaslyang has quit [Client Quit]
<apotheon>
. . . or do you *replace* the daily notes for a week with one wekly notes section, and so on?
<baweaver>
Yep.
<baweaver>
As I said, stupidly simple.
<apotheon>
interesting
<baweaver>
It's the same reason I use dev.to
<baweaver>
I _could_ write a custom engine in Rails, but the point is to write not to make an engine
<baweaver>
So minimize overhead, don't fret over optimizing the entire thing, and it's much easier in the long run to write against.
<baweaver>
Granted I do export the doc yearly so it doesn't get too massive.
<apotheon>
I stumbled into an interest in fountain pens and fine paper at the same time I stumbled into reading about the bullet journal method, and I use a modified bullet journal practice with paper and pen chosen to make handwriting an enjoyable experience. I also keep "commonplace book" style records of thoughts.
<apotheon>
Ah, so you rotate logs annually.
<baweaver>
Cloud accessibility is a huge win for me.
<apotheon>
I can see how that'd be the case.
<baweaver>
If I forgot my notebook for a day I'd spiral
<apotheon>
Your description makes me think I might want to modify how I handle my journal a little differently, though.
<baweaver>
The big thing is I don't want my notes to become an obsession of optimizing
<baweaver>
so I explicitly sit with that discomfort
<apotheon>
I have a leather pocket journal cover with three pocket-size notebooks in it. I rotate so that I have the three most recent (the current, previous, and previous-previous). I'm thinking of replacing the previous-previous with a summary notebook that sums up previous months.
<al2o3-cr>
baweaver: never pencil and paper?
<apotheon>
As old notebooks get rotated out, they just end up in the archive on a shelf.
<baweaver>
Rarely. I'll occasionally doodle and scan it into the doc
<al2o3-cr>
baweaver: for ideas?
<baweaver>
Whiteboarding is on my iPad through jamboard
<baweaver>
So I can cross-link that. Not the greatest drawing tool but doesn't need to be either.
cb` has quit [Ping timeout: 265 seconds]
<al2o3-cr>
who writes a synopsis first before even writing anything?
mynameisdebian has quit [Ping timeout: 260 seconds]
<baweaver>
That article? I wrote it in one pass
<baweaver>
Sometimes I do outline first, but that has to be a pretty significant one to do that
chalkmonster has quit [Quit: WeeChat 2.9]
<al2o3-cr>
baweaver: sorry, didn't mean the article, regarding gems.
<baweaver>
Ah, I start with Pry and see if I can get something to work
<baweaver>
Then I write up the explain
davispuh has quit [Ping timeout: 240 seconds]
<al2o3-cr>
baweaver: pretty much my process :)
bocaneri has quit [Remote host closed the connection]
gix has joined #ruby
<al2o3-cr>
baweaver: inverted process actually.
sameerynho has joined #ruby
akem has joined #ruby
nicholaslyang has joined #ruby
SeepingN has joined #ruby
whathappens has quit [Ping timeout: 240 seconds]
prestorium has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
whathappens has joined #ruby
whathappens has quit [Client Quit]
nicholaslyang has joined #ruby
davispuh has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
Nowaker has quit [Ping timeout: 264 seconds]
rose_nd_ash has quit [Remote host closed the connection]
blender has joined #ruby
blender_ has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apotheon>
_repeating something does not make it true_
nicholaslyang has joined #ruby
cb` has joined #ruby
<leftylink>
dang... I really don't appreciate that
BSaboia has quit [Quit: This computer has gone to sleep]
<leftylink>
probably a sign that I should take a break
<leftylink>
cool off a bit
BSaboia has joined #ruby
<al2o3-cr>
apotheon: it's true
<apotheon>
You have yet to give a coherent answer to any question I asked about many of your assertions, and you have yet to offer a coherent disputation of any of my explanations for what I think about these technical matters, so if you wish to actually get me to believe you when you make assertions you need to "up your game". If you don't, and just want to keep re-asserting emptily instead, you can just
<apotheon>
be secure in your belief in the truth of what you say and have to deal with the fact that I still don't have any reason to believe you.
vondruch_ has joined #ruby
<apotheon>
With that, I'll just stop treating this as an actual attempt to communicate from you, unless you say something cogent and relevant.
<havenwood>
Be nice. I'm an iterator. Try stepping!
<baweaver>
havenwood.hats.next
<baweaver>
See, havenwood _is_ an iterable!
<apotheon>
havenwood: I'm trying to be nice. I'm tired of getting bombarded with statements that I'm wrong with no substance.
<baweaver>
havenwood.hats.prev
vondruch has quit [Ping timeout: 246 seconds]
vondruch_ is now known as vondruch
<al2o3-cr>
so an iterator needs a next/prev
<havenwood>
#!> undefined method `prev' for #<Havenwood>
<havenwood>
i guess we could do EnumeratorWithIndeterminateYielding
<al2o3-cr>
havenwood: tell me this, a block excutes _once_ per invocation?
<havenwood>
TRANSIENT_HEAP_DEBUG_INFINITE_BLOCK is a nice name.
sphex has quit [Read error: Connection reset by peer]
BSaboia has quit [Quit: This computer has gone to sleep]
<havenwood>
al2o3-cr: Blocks yield once when yielded, yeah.
<havenwood>
al2o3-cr: Yielding to a block always yields once, but you can of course yield as many times as you'd like.
adu has quit [Quit: adu]
<al2o3-cr>
havenwood: then, it's iterable.
<apotheon>
so's a car
<havenwood>
al2o3-cr: if by that you mean it can be yielded as a step in iteration, I agree
<al2o3-cr>
apotheon: please.
<apotheon>
thank you
<al2o3-cr>
welcome
<apotheon>
don't mind if I do
<havenwood>
al2o3-cr: does "iterable" apply only to the object iterating or also to the yielded blocks for a particular step?
<havenwood>
al2o3-cr: my inclination is the former, but you could use the term more broadly
<al2o3-cr>
havenwood: every single block definition in ruby is an iterable. fact.
<apotheon>
As an English adjective, "iterable" applies to the thing performed by an iterator.
<havenwood>
i'd prefer to say a yield block may be a step in iteration, but a block can also be yielded two as a once-off, where there isn't any iteration involved.
<apotheon>
The iterator performs the repeating process on a "series" of things.
<apotheon>
err, s/performed/acted upon/
<apotheon>
bleh
<havenwood>
i'd normally think that a thing isn't a single step of iteration when it has no further steps and those like it don't either. that's just a thing. oneness.
<havenwood>
i suspect the argument is about broadness of definition.
<havenwood>
are the shoes "walking"?
<havenwood>
or rather, is a step walking.
<al2o3-cr>
havenwood: probably.
<apotheon>
A single step is a step.
<havenwood>
and then are all steps walking
<apotheon>
Performing that step is stepping.
<apotheon>
Walking is directed repetition of stepping.
<havenwood>
what if it's not followed by a another step, nor are things like it? is doing the splits a walking? a single, big step.
sphex has joined #ruby
<apotheon>
That's just a step.
BSaboia has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr>
havenwood: that's enumerator, that class Enumerator.
schne1der has joined #ruby
adu has joined #ruby
<al2o3-cr>
gives you methods peek, rewind etc
<havenwood>
I've tried to rewind, and seem incapable.
<havenwood>
I must not be an Enumerator.
<al2o3-cr>
lol
<baweaver>
Ippo!
Aderium has joined #ruby
<al2o3-cr>
havenwood: on IO peek is just seek 1 byte forward (little bit more to it :) rewind is just seek 0 etc
Nowaker has joined #ruby
<tubbo>
what the shit are you guys talking about
* baweaver
shrugs
<baweaver>
ohai tubbo
<tubbo>
this whole language was made up by a bunch of japanese people and you're arguing over what words they used? :P
<tubbo>
hay baweaver
<baweaver>
How's things
<tubbo>
not too bad
<tubbo>
how have you been?
<baweaver>
Not too bad
<baweaver>
Complained about Ruby too much at Square
<baweaver>
...so they put me in charge of it. Still figuring that one out
<tubbo>
lol
<tubbo>
when you're saying "complained about ruby", you mean ruby the language or just your ruby code at square?
<baweaver>
Yes
<tubbo>
damn
<baweaver>
More of how we were running Ruby, improvement ideas, and some other things
<tubbo>
your co-workers must hate you
<baweaver>
Surprisingly no
<tubbo>
"haha we'll put him in charge of the ruby code, then he won't EVER be able to leave!!"
<baweaver>
havenwood doesn't hate me yet
<baweaver>
To be fair it's great promo material for scope and impact
<tubbo>
nice
cb` has quit [Ping timeout: 256 seconds]
flak has joined #ruby
<tubbo>
i do enjoy your regular blog posts on dev.to
<baweaver>
Need to get back to that more
<baweaver>
We're working on a Ractor one with Benoit and havenwood
<tubbo>
nice
<tubbo>
do you pronounce it "r-actor" as well?
<tubbo>
or is it "ractor"
<tubbo>
because i really want it to be "ractor"
<baweaver>
Ractor, or Ruby Actor
<baweaver>
Had to stop myself from saying Reactor
BSaboia has quit [Quit: This computer has gone to sleep]