[#3741] Re: Why it's quiet -- standard distribution issues — Aleksi Niemel<aleksi.niemela@...>
I think it's the feature of the mailing list archive to create a threads of
[#3756] RE: XMP on comments — Aleksi Niemel<aleksi.niemela@...>
> require "xmp"
[#3766] modulo and remainder — Dave Thomas <Dave@...>
[#3776] Kernel.rand — Aleksi Niemel<aleksi.niemela@...>
How about defining:
[#3781] Widening out discussions — Dave Thomas <Dave@...>
[#3795] Re: Array.uniq! returning nil — Aleksi Niemel<aleksi.niemela@...>
> As matz said in [ruby-talk:3785] and Dave said in [ruby-talk:1229],
Hi, Aleksi,
[#3823] Re: Array.pick — Aleksi Niemel<aleksi.niemela@...>
> > Just a general comment--a brief statement of purpose and using
[#3827] JRuby? — Aleksi Niemel<aleksi.niemela@...>
Is there or will there be Ruby equivalent of JPython?
[#3882] Re: Array.uniq! returning nil — Aleksi Niemel<aleksi.niemela@...>
> |look too strange, confusing, or cryptic. Maybe just @, $, %, &.
Hi,
[#3918] A question about variable names... — Dave Thomas <Dave@...>
[#3935] If your company uses Pallets, Skids, Boxes, Lumber, etc. — pallets2@...
[#3956] Tk PhotoImage options — andy@... (Andrew Hunt)
Hi all,
[#3971] Thread and File do not work together — "Michael Neumann" <neumann@...>
following example do not work correctly with my ruby
[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>
> Principle of Least Effort.
Hi,
[#4005] Re: Pluggable functions and blocks — Aleksi Niemel<aleksi.niemela@...>
Aleksi makes a question:
[#4008] Ruby installation instructions for Windows — Aleksi Niemel<aleksi.niemela@...>
I had to write these instructions for my friends. I thought it might be nice
[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>
On 15 Jul 2000 22:08:50 -0500,
Hi,
[#4057] Re: What are you using Ruby for? — Aleksi Niemel<aleksi.niemela@...>
Johann:
[#4082] Re: What are you using Ruby for? — Aleksi Niemel<aleksi.niemela@...>
[#4091] 'each' and 'in' — hal9000@...
I just recently realized why the default
[#4107] Re: 'each' and 'in' -- special char problem? — schneik@...
[#4114] Method signature - a question for the group — Dave Thomas <Dave@...>
[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>
Hi,
[#4158] Getting Tk to work on Windows — "Michael Neumann" <neumann@...>
Hi....
[#4178] Partly converted English Ruby/Tk widget demo working. — Conrad Schneiker <schneik@...>
Hi,
[#4234] @ variables not updated within method? — Hugh Sasse Staff Elec Eng <hgs@...>
Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
On 27 Jul 2000, Dave Thomas wrote:
[#4267] Ruby.next, Perl6, Python 3000, Tcl++, etc. -- Any opportunities for common implementation code? — "Conrad Schneiker" <schneiker@...>
Hi,
"Conrad Schneiker" wrote:
[ruby-talk:03882] Re: Array.uniq! returning nil
> |look too strange, confusing, or cryptic. Maybe just @, $, %, &.
>
> Other noise characters? Come on. ;-)
Right! No more unnecessary noise!
> Currently I feel no need for self-modifying, non-conditional
> combination.
I appreciate your feelings! It's great to hear about them. They reflect the
design ideas of the language.
> Basicly one should use copying (non-bang) version of the
> methods.
Why's that so? I mean it's a nice policy, but then we should be using it as
consistenly (and much) as possible. But that's not good for performance.
How about the opposite policy?
For me the self-modifying, non-conditional combination is the thing I'm
using most of the time.
Most of my code is non-conditional by nature. Most of my code is also
self-modifying as much as possible, rather than copying -- of course one
copies things quite a lot, but I feel it should be done only when necessary.
So maybe I should regard my code being non-unnecessarily-copying.
a = "foo"
b = a.split.uniq!.size # I don't say b = a.dup.split.dup.uniq.size
If I want to copy things, I can make my point clear with dup. Afterall, it's
much easier to say dup when needed (a.dup.action!) than to make something
happen in-place with automatically copying routines.
Anyway, I don't care about this so much. I can easily adapt to code in a way
Ruby wants. Here I just feel Ruby has not made clear decision. If the policy
is 'Ruby forces you to split your self-modifying non-conditional statements
to multiple lines' I wonder why easiness was promoted for blocks. As far as
I can see:
a = ["fo", "ha"].collect do |txt| txt+"r" end
should have been (forced and) coded as
addR = proc do |txt| txt+"r" end
a = ["fo", "ha"].collect(addR)
In the latter example the self-modifying part is splitted. Actually the
latter version might be better anyway, it's just that I love when I *can*
code like the upper one, *and* when I'm not forced to code like the latter.
Even then I might code it as latter. :)
Well, my strongest argument is yet to come. If the difference between method
and method! would be just the fact the latter modifies in-place, it'd be:
1) easy to learn
2) easy to remember
3) and most of all, very easy to make performance changes to the existing
code
The last point is important because with the current way you may end up
hitting yourself when optimizing bigger source base. This example is made
up, for dna-library:
def apply_big_sequence(big)
analysis = Feature.new(uniq).big.uniq.map do |feat| Feature.calc(feat)
end
analysis.use(big)
2**big.length
end
create_other_features( apply_big_sequence("CGAC"))
Then we notice this is too slow because the return value of 'big' is *really
big* and hardly fits our memory, so we choose to lose the copy-by-default.
This version doesn't work:
analysis = Feature.new(uniq).big.uniq!.map! do |feat| Feature.calc(feat)
end
so we have to remember to split up:
def apply_big_sequence(big)
big = Feature.new(uniq).big
analysis = (big.uniq! || big).map! do |feat| Feature.calc(feat) end
analysis.use(big)
2**big.length
end
but whoops, now we override our initial reference to big, which is supposed
to be used later.
And suddenly the change from dup.self_modify! to plain self_modify! has
caused the need for a large code change (not just '!'), one additional and
rarely-used idiom, and one additional variable.
I think this is acceptable, in most other languages you can't do as much
with as little coding. This is just a little bit akward when compared to the
rest of the language design.
If we continue on the current track, we have to be really careful in all
documentation, to announce method! to be self-modifying-conditional most of
the time (instead of previously informed simply self-modifying).
- Aleksi