Hi
I thought this list is for discussing Ruby including its "strange"
things (doing things which are not intended) - we don't want to speak
about a=b+1)
- Do you disagree implementing a warning when changing defaults by using
a normal key?
I believe when that occurs, then in most cases it's NOT intended.
Thanks for 1) and 2); I just answered that many times because of being
totally misunderstood,
Regarding friendliness, Ziegler used the wrong words. - Sorry, that's
completely out of the place.
Opti
···
Am 08.06.22 um 18:48 schrieb Jack Royal-Gordon:
I have to agree with Austin here. Die, I’ve generally stopped reading
your emails to this group (unless I’m in a mood to be frustrated),
because I know that you’re going to take some simple feature, do
something odd with it, and then complain about the results. And then,
when some well-intentioned reader tries to explain why what you’re
doing is not appropriate, you argue with them.Austin is right that *every* programming language will have some
obtuse features. Assuming that you are really trying to accomplish
what you say you want to do, instead of insisting that it should work
the way you want it to, do one of two things:1) Find out the “right” way to do it (there is often more than one,
and different users may disagree on the right way, so find a way that
works and makes sense to **you**).2) Realize that maybe what you’re trying to do is not a good fit for
the feature you’re trying to use and find a different feature to do it
with. For example, it’s good practice to avoid using integers as Hash
keys, simply because of the similarities between the syntax for a Hash
key and and an Array index. Violate this principle at your own risk.Further, it’s one thing to explore a feature, find what appears to be
inconsistent behavior and point it out. It’s quite another thing, when
others on this list invest their precious time responding to your
post, to insult them by arguing (which you seem to do every time).
Please recognize that if someone who responds to you really gives a
poor argument or tells you something incorrect, someone else will
definitely correct them.I don’t normally respond to these sorts of occurrences, but you’ve
been doing this for so long that I'm really tired of seeing it. Please
stop!On Jun 8, 2022, at 7:59 AM, Austin Ziegler <halostatue@gmail.com >> <mailto:halostatue@gmail.com>> wrote:
As I wrote, it's about the (strange - not coherent/consistent)
"syntax"
you have to use to get what you want. I pointed out, that for
Array it
is again another form.Just stop. You have been trolling this mailing list for years,
convinced that your view is the only correct view of Ruby and
refusing to accept any mental model except your own. If, indeed, you
actually know C, then you know that there’s places in C syntax where
consistency simply doesn’t exist, as is the case with *any*
programming language. Each and every instance of UB is a lack of
consistency and clarity where one is invited to mess around and find
out what your compiler does, because every compiler will do it
differently.In comparison, Ruby object instantiation is crystal clear *and*
well-documented. Just because you can’t accept that the semantics are
foreign *to you* does not make them surprising, unobvious, or
anything except "foreign to you".Let’s try to provide some education to readers of the thread, even
though it will obviously not be you.But (very) surprising for me is that h=Hash.new(); h[1] << 1 # we
should at least get a warning if changing the defaultval; nobody
expects after changing h[1], that (the key) h[1] does not exist,
although it's clear when understanding what is done.Variables in Ruby are not locations. They are labels. In C, the
expression `uint32_t a = b = 3` takes up approximately 8 bytes of
stack memory. In Ruby, the expression `a = b = 3` takes up
approximately one Object of memory (certain numbers are special in
most implementations of Ruby, but that is an implementation detail
about most numbers being "internalized").Variables in Ruby are labels to *references* (to objects).
Expressions in Ruby return *references* (to objects). With this
minimal information, it becomes pretty easy to reason that `h =
Hash.new()` gives me a reference to the Hash which I have labeled
`h`. If I don’t understand why `h[1] << 1` modifies `h.default`, then
I read some documentation and realize that even if I do `h[1]`, that
does not necessarily mean `h.has_key?(1)` returns true because I
provided a mutable default object. Or I could even see
`h[1].object_id == h[2].object_id` returning a true value, and
enlightenment might actually occur.I might actually then be able to reason that `h[1] == h.default`
because I’m really dealing with object references all the way down so
that when I modify `h[1]` because `h.has_key?(1) == false`, I’m
really modifying `h.default`. This isn’t something that would occur
to a C genius, of course, because reading the fine manual would
disabuse said genius of their ability to troll people on the same or
similar topics again, and again, and again.-a
--
Austin Ziegler • halostatue@gmail.com <mailto:halostatue@gmail.com> •
austin@halostatue.ca <mailto:austin@halostatue.ca>
http://www.halostatue.ca/ • http://twitter.com/halostatueUnsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>