Since everyone is still speaking to Ilias far too often, I'll try to use
this as a teaching experiment. I'll post the code that does exactly what he
asked for. Exactly. If he follows standard form, you should see complaints
about the non-code content of this message and the solution itself.
The solution:
···
On Sat, Jun 4, 2011 at 6:50 AM, Ilias Lazaridis <ilias@lazaridis.com> wrote:
1.9
names = ["Jane", "Michele", "Isabella"]
# current behaviour
names.each do |name|
print name
end
#Question: How can I alter the behaviour of "each" in the following
way:
names.each do
print item # "item" is used by default
end
Is this possible, without going to C-level?
#######################################################
### NEVER USE THIS CODE, unless your name is Ilias! ###
#######################################################
class Item
def initialize(item) @item = item
end
attr_reader :item
end
class Array
alias_method :sane_each, :each
def each(&iterator)
if iterator.arity.zero?
sane_each do |item|
Item.new(item).instance_eval(&iterator)
end
else
sane_each(&iterator)
end
end
end
names = %w[Jane Michele Isabella]
names.each do |name|
puts name
end
names.each do
puts item
end
__END__
The most important thing to learn about Ilias is that he's not a programmer
and has no desire to become one. Ever. Look at his code from this example.
Ilias never posts project code. He doesn't do anything. He just attacks
esoteric corners of syntax to incite debate.
His requests almost always involve terrible ideas that obviously violate
some good programming practice. If he doesn't know this, he has never
learned it from all the years he has spent in many programming language
groups. If he does know it, he's using his knowledge optimally to push the
most buttons. Either way, you know what you need to know.
Note how he's never learned the tiniest bit of Ruby during any of his stays
with us. He doesn't indent like we do, he wouldn't think to call puts(),
etc. Ilias literally cannot assimilate, beyond minor efforts to gain
sympathizers.
See his other messages for examples of how he usually selects the most
abrasive language. Words like "BARRIER" are used for a desired effect and
he loves it when we tell him not to talk to us that way.
You all know that I try very hard to be polite and helpful. Ilias is the
exception. I totally believe he is diagnosable. Anytime we push "Reply,"
we feed his needs. It's hard, but you really have to ignore him. It's the
only option he leaves to us.
You won't see me respond when he complains about this message. He'll say
stupid things I'm dying to correct for all the watching eyes. That's what
Ilias does. Though it hurts me, I won't push "Reply." Just writing a
message like this about a person kill's me. But these are the only ways to
minimize his reach. We are not playing this game against a rational
opponent.
Choose another soul to save on Ruby Talk and let this one go.
Actually it would be possible, although very ugly.
You need to evaluate in the context of the current instance (instance_eval) - not yield - the block you pass to the each method of your object (an array in this case).
Then you can define a print method that behaves like a coroutine (check out ruby fibers) and returns each element of your array.
Sorry I'm not writing code here, I'm using my cellphone.
Michaël Sokol
···
On Jun 4, 2011, at 8:23 AM, Peter Hickman <peterhickman386@googlemail.com> wrote:
It'll be difficult for me to refrain from replying, because I almost
never check who says something before responding. I have cultivated the
habit of responding based on content rather than name, for the most part.
It's pretty clear that, in this case, I should make the effort to do
otherwise. Thanks for the informative email, James.
···
On Sat, Jun 04, 2011 at 11:50:00PM +0900, James Gray wrote:
On Sat, Jun 4, 2011 at 6:50 AM, Ilias Lazaridis <ilias@lazaridis.com> wrote:
1.9
names = ["Jane", "Michele", "Isabella"]
# current behaviour
names.each do |name|
print name
end
#Question: How can I alter the behaviour of "each" in the following
way:
names.each do
print item # "item" is used by default
end
Is this possible, without going to C-level?
Since everyone is still speaking to Ilias far too often, I'll try to use
this as a teaching experiment. I'll post the code that does exactly what he
asked for. Exactly. If he follows standard form, you should see complaints
about the non-code content of this message and the solution itself.
The solution:
#######################################################
### NEVER USE THIS CODE, unless your name is Ilias! ###
#######################################################
class Item
def initialize(item) @item = item
end
attr_reader :item
end
class Array
alias_method :sane_each, :each
def each(&iterator)
if iterator.arity.zero?
sane_each do |item|
Item.new(item).instance_eval(&iterator)
end
else
sane_each(&iterator)
end
end
end
names = %w[Jane Michele Isabella]
names.each do |name|
puts name
end
names.each do
puts item
end
__END__
The most important thing to learn about Ilias is that he's not a programmer
and has no desire to become one. Ever. Look at his code from this example.
Ilias never posts project code. He doesn't do anything. He just attacks
esoteric corners of syntax to incite debate.
His requests almost always involve terrible ideas that obviously violate
some good programming practice. If he doesn't know this, he has never
learned it from all the years he has spent in many programming language
groups. If he does know it, he's using his knowledge optimally to push the
most buttons. Either way, you know what you need to know.
Note how he's never learned the tiniest bit of Ruby during any of his stays
with us. He doesn't indent like we do, he wouldn't think to call puts(),
etc. Ilias literally cannot assimilate, beyond minor efforts to gain
sympathizers.
See his other messages for examples of how he usually selects the most
abrasive language. Words like "BARRIER" are used for a desired effect and
he loves it when we tell him not to talk to us that way.
You all know that I try very hard to be polite and helpful. Ilias is the
exception. I totally believe he is diagnosable. Anytime we push "Reply,"
we feed his needs. It's hard, but you really have to ignore him. It's the
only option he leaves to us.
You won't see me respond when he complains about this message. He'll say
stupid things I'm dying to correct for all the watching eyes. That's what
Ilias does. Though it hurts me, I won't push "Reply." Just writing a
message like this about a person kill's me. But these are the only ways to
minimize his reach. We are not playing this game against a rational
opponent.
Choose another soul to save on Ruby Talk and let this one go.
His requests almost always involve terrible ideas that obviously violate
some good programming practice.
FWIW, his three BARRIER requests all were accepted and solved on ruby-core, and his latest request for "executed?" – which I personally consider a good idea – looks like to go the same way.
I nevertheless find his style of running personal attacks out of nowhere very counter productive and offending. Someone should tell him that he could try to change the world with other tools than chainsaws and atomic bombs. Must be some kind of bad childhood.
Have you checked the validity of this information? It was copied from
a wikipedia "article" (the original article was deleted, due to
violation of the wikipedia policies).
The most important thing to learn is:
when is it "expressing negative feelings" and when is it "defamation
of character":
See, I'm looking in parallel for a contract within the ruby domain (as
I've chosen ruby for my own projects and thus I like to avoid to work
in another languages).
If you (people) continue to attack me on a *professional* level, I'll
have to react at some point.
So, please, set a filter, don't read or go get a dog.
Or stay calm and focus on the technical stuff.
.
···
On 4 Ιούν, 17:50, James Gray <ja...@graysoftinc.com> wrote:
On Sat, Jun 4, 2011 at 6:50 AM, Ilias Lazaridis <il...@lazaridis.com> wrote:
>#Question: How can I alter the behaviour of "each" in the following
>way:
>names.each do
> print item # "item" is used by default
>end
>
>Is this possible, without going to C-level?
It's possible but you have to redefine the each method.
ok
That reminds me Groovy's it.
I don't know "Groovy", but I dislike the "it", as it cannot be spoken
like "each item" or "each value".
I've just noticed repetitions within code like that:
names.each { |name| puts name} # 3 times "name(s)"
names.each { puts item }
names.each { puts e) # e = entry
Currently I have no plan to change the core like that.
So this would be a low-priority issue?
Would a thoroughly worked out patch be accepted?
.
···
On 6 Ιούν, 01:11, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
In message "Re: CORE - Altering Behaviour of "each do" (default param "item")" > on Sat, 4 Jun 2011 20:50:25 +0900, Ilias Lazaridis <il...@lazaridis.com> writes:
>#Question: How can I alter the behaviour of "each" in the following
>way:
>names.each do
> print item # "item" is used by default
>end
>
>Is this possible, without going to C-level?
It's possible but you have to redefine the each method.
ok
That reminds me Groovy's it.
I don't know "Groovy", but I dislike the "it", as it cannot be spoken
like "each item" or "each value".
I've just noticed repetitions within code like that:
names.each { |name| puts name} # 3 times "name(s)"
names.each { puts item }
names.each { puts e) # e = entry
Currently I have no plan to change the core like that.
So this would be a low-priority issue?
Would a thoroughly worked out patch be accepted?
.
···
On 6 Ιούν, 01:11, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
In message "Re: CORE - Altering Behaviour of "each do" (default param "item")" > on Sat, 4 Jun 2011 20:50:25 +0900, Ilias Lazaridis <il...@lazaridis.com> writes:
Chad, you might want to see if your mail client has the equivalent of a killfile. Amusingly enough, I 'killfiled' Ilias this morning before the latest kerfuffle.
James, thanks for a careful and well-thought-out response.
All other issues aside, "Dr. Lizardo" appears to want to use a language that is almost but not quite completely unlike the language he has insisted he 'must' or 'strongly desires' to use. Certainly he is after a 'Ruby' that is nothing at all like the Ruby we know and love.
One must wonder why...
regards,
Bill
···
On Jun 4, 2011, at 11:10 AM, Chad Perrin wrote:
On Sat, Jun 04, 2011 at 11:50:00PM +0900, James Gray wrote:
It'll be difficult for me to refrain from replying, because I almost
never check who says something before responding. I have cultivated the
habit of responding based on content rather than name, for the most part.
It's pretty clear that, in this case, I should make the effort to do
otherwise. Thanks for the informative email, James.
There is another approach which does not suffer from the side effect of changing self which can be disastrous: create a thread local which holds a stack of values and make item peek at the top element of it:
class Object
def new_each
stack = (Thread.current[:__item__] ||= )
each do |x|
stack.push x
begin
yield
ensure
stack.pop
end
end
self
end
private
def item
stack = Thread.current[:__item__] or
raise "Not in new_each"
stack.last
end
end
a = %w{a b c}
b = [1, 2, 3]
a.new_each do
printf "%-20s: %p\n", 'outer 1', item
b.new_each do
printf "%-20s: %p\n", 'inner', item
end
printf "%-20s: %p\n", 'outer 2', item
end
This approach
- does not change 'self'
- is thread safe
- is nesting safe
Kind regards
robert
···
On 04.06.2011 16:19, Michael Sokol wrote:
Actually it would be possible, although very ugly.
You need to evaluate in the context of the current instance
(instance_eval) - not yield - the block you pass to the each method
of your object (an array in this case).
Then you can define a print method that behaves like a coroutine
(check out ruby fibers) and returns each element of your array.
Providing help is a personal matter for many people. You won’t get friends here as long as you snub everyone who is questioning your approach or motivation. This is help as well and demands proper handling on the personal level from your side, too.
Still, this is *ruby-talk* primarily, even if you are using it over a Usenet gateway. You are free to open up mailing lists named ruby-request or ruby-support. Let’s see how many people want to subscribe those and focus on your topics in the way and with the level of focus you want.
Have you checked the validity of this information? It was copied from
a wikipedia "article" (the original article was deleted, due to
violation of the wikipedia policies).
Probably this page:
It doesn't seem that "violation" was the primary concern, so much as that
there wasn't enough reliable information to back it up. If that wasn't the
case, I have to imagine that "notability" would've kicked in.
The most important thing to learn is:
when is it "expressing negative feelings" and when is it "defamation
of character":
Legal threats again? Is this the only way you can get anyone to take you
seriously?
"Defamation is false and unprivileged spoken words or written publication,
which exposes any living person to hatred, contempt, ridicule, or which causes
him/her to be shunned or avoided, or which has a tendency to injure him/her in
his/her trade or occupation."
So, for you to show that this has occurred, you need to demonstrate that not
only are these things false, but that they actually cause you to be shunned,
avoided, hated, ridiculed, etc. I don't think anything anyone else has said
about you so far has done more damage to your reputation than you have,
yourself, in very nearly every exchange.
In particular:
"a false statement of fact;
that is understood as
being of and concerning the plaintiff; and
tending to harm the reputation of plaintiff."
Is anyone here making any false statements of _fact_ about you?
Now, let's look at possible defenses, if you actually sued one of us:
"What defenses may be available to someone who is sued for defamation?
There are ordinarily 6 possible defenses available to a defendant who is sued
for libel (published defamatory communication.)
1. Truth. This is a complete defense, but may be difficult to prove."
While it may be difficult to show that you're a troll, many of the other
statements about you should be relatively easy to prove, especially when
everything you say has been archived.
" 2. Fair comment on a matter of public interest. This defense applies to
"opinion" only, as compared to a statement of fact. The defendant usually
needs to prove that the opinion is honestly held and the comments were not
motivated by actual "malice." (Malice means knowledge of falsity or reckless
disregard for the truth of falsity of the defamatory statement.)"
Most of the statements which seem to bother you so much are also statements of
opinion -- for instance, "It's not worth our time to respond to Ilias
anymore."
" 6. Plaintiff's poor reputation. Defendant can mitigate (lessen) damages for
a defamatory statement by proving that the plaintiff did not have a good
reputation to begin with. Defendant ordinarily can prove plaintiff's poor
reputation by calling witnesses with knowledge of the plaintiff's prior
reputation relating to the defamatory content."
And there are all kinds of witnesses here.
If you (people) continue to attack me on a *professional* level, I'll
have to react at some point.
Please do.
If you do end up suing for defamation, while it's going to suck for whoever
ends up defending, it's also likely to make your reputation that much worse,
and more widespread. It would be incredibly self-defeating, and all kinds of
fun to watch.
If you instead react by trying to learn why it is that you're getting these
comments -- you could start by actually reading them, instead of writing them
off as "off-topic" or "personal" -- then your reputation would likely improve
dramatically, as would your productivity and your contributions to the
community. People would _want_ to help you, instead of wanting you to go away.
So, please, set a filter, don't read or go get a dog.
It's clear that you've already either filtered me or chosen to ignore
everything I have to say. Ah, well. Hopefully this exchange is useful to
someone else, and it will satisfy my curiosity as to whether there's anyone
who actually agrees you here.
Or stay calm and focus on the technical stuff.
Gladly, on the condition that you will do the same. That means being willing
to discuss some context, what problem you're actually trying to solve, and
where your "requirements" are coming from.
···
On Sunday, June 05, 2011 09:00:31 AM Ilias Lazaridis wrote:
I vote against because I prefer explicit function arguments (block
parameters) over implicit ones. The approach with the predefined name
only works well for cases where there is a single argument but will
become ugly soon if you need multiple arguments. Either you need to
use array access (which is worse than using explicit argument names
because those names will make code more readable) or allow mixed mode
(explicit arguments where desired, implicit as default). I do not
believe that this makes code easier to read and less prone to errors.
Btw, what you call "specification" is just an example of a single use
case. For a language change the behavior would need to be _uniform_
across the board, otherwise it is plain obfuscation. As I hope you
are aware there are multiple implementations of #each - and the number
can and will actually change at runtime. So any change would have to
be applied to all of them - and there is no automatism that could do
it unless you are willing to have a new #each with a different name.
It seems to me that you are suggesting language changes without an
idea of the consequences. Please do a bit more reasoning before you
come up with such suggestions.
robert
···
2011/6/6 Ilias Lazaridis <ilias@lazaridis.com>:
On 6 Ιούν, 01:11, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
Hi,
In message "Re: CORE - Altering Behaviour of "each do" (default param "item")" >> on Sat, 4 Jun 2011 20:50:25 +0900, Ilias Lazaridis <il...@lazaridis.com> writes:
>#Question: How can I alter the behaviour of "each" in the following
>way:
>names.each do
> print item # "item" is used by default
>end
>
>Is this possible, without going to C-level?
It's possible but you have to redefine the each method.
ok
That reminds me Groovy's it.
I don't know "Groovy", but I dislike the "it", as it cannot be spoken
like "each item" or "each value".
I've just noticed repetitions within code like that:
names.each { |name| puts name} # 3 times "name(s)"
names.each { puts item }
names.each { puts e) # e = entry
Currently I have no plan to change the core like that.