Kudos to all Ruby creators/enhancers/users

D

donn

I can't stop myself from using 15 minutes of my work time to express my
gratitude to Matz and everyone else involved with the creation,
enhancement, and use of Ruby. This comes from a 20 yr procedural
programmer raised on Basic, Assembler, Cobol, SAS, etc... I've been
learning Ruby for the past year, singing its praises to all around me.
And my employer, having such value of my opinion, has decided to
encourage me to learn C#, as it is the standard (from his point of
view.)

C#, in my opinion, is garbage trying to smell sweet. Especially in the
area of arrays. And here is where I solicit from you your best C#
practice to emulate Ruby. It's a simple matter of how big an array is.
In Ruby, I elegantly add member to an array using "a << 'something'."
It knows how many elements there are simply by adding. When I want to
use the elements, I elegantly code "a.each{|x| whatever}".

Now, in C#, I have to declare the array of a specific type. I have to
provide a size, x. I then have to brute force assign an element to a
specific index. And if I want to use the elements of the array, I use
a foreach statement. And because it is a statement, I have to declare
the type of receiving variable because foreach doesn't know the type of
array. And when foreach executes, it is for every element up to x, not
the number of populated elements.

Is there and elegant way in C# to append members into an array, and
execute foreach for each populated member? Or do I have to code my own
extensions to class array such that it acts like Ruby? Has someone
already done this in C#?

Once again, I can't express my appreciation enough. I'm thinking of
learning C# for my company, but still implement everything in Ruby
anyway. Hell, I can prototype production ready code in Ruby so much
faster than I can translate it to C#.

Thanks a bunch,
dvn

dvn
 
L

Leslie Viljoen

Is there and elegant way in C# to append members into an array, and
execute foreach for each populated member? Or do I have to code my own
extensions to class array such that it acts like Ruby? Has someone
already done this in C#?

Look at ArrayList. I think C# is the best of the RAD GUI languages,
but I still wish every day that I could open up a studio of some type,
drag some buttons around, double-click on one of them and enter Ruby
code.

Then I could probably throw away C# and just use Ruby for 99% of my work.

Les


--
Man's unfailing capacity to believe what he prefers to be true rather
than what the evidence shows to be likely and possible has always
astounded me. We long for a caring Universe which will save us from
our childish mistakes, and in the face of mountains of evidence to the
contrary we will pin all our hopes on the slimmest of doubts. God has
not been proven not to exist, therefore he must exist.

- Prokhor Zakharov
 
R

rhossi

You can play with some of the array manipulation features you mentioned
downloading LINQ (Language Integrated Query). The upcoming version of
C#. (http://msdn.microsoft.com/vcsharp/future)
I`ve been programming with C# since 2000, but since I met Ruby, I wish
I could write every program in it.
It's by far, much more productive than C#. But there is a partial port
of Ruby to the .NET Platform called Ruby.CLR.
Lots of people says that with current implementation of the CLR would
be not possible to support such dynamic language, like Ruby.
But recently the Ruby.CLR project creator John
Lam(http://www.iunknow.com), was hired by Microsoft to integrate the
CLR Dynamic Team to help them improve the CLR Dynamic Support. There is
already a port of Python called IronPyhton to .NET world.

HTH

Felipe Garcia
 
D

David Vallner

--------------enigC6C0316FF5D06DBA5146AD50
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

C#, in my opinion, is garbage trying to smell sweet. Especially in the=
area of arrays. And here is where I solicit from you your best C#
practice to emulate Ruby. It's a simple matter of how big an array is.=
In Ruby, I elegantly add member to an array using "a << 'something'."
It knows how many elements there are simply by adding. When I want to
use the elements, I elegantly code "a.each{|x| whatever}".
=20

Ruby Array !=3D C# array. Ruby Array =3D C# ArrayList. (Sort of.)
Now, in C#, I have to declare the array of a specific type. I have to
provide a size, x. I then have to brute force assign an element to a
specific index.

Made irrelevant by the above. Learn C# before criticising it.
And if I want to use the elements of the array, I use
a foreach statement. And because it is a statement, I have to declare
the type of receiving variable because foreach doesn't know the type of=

That has nothing to do with the fact it's a statement.

AFAIK, C# 3.0 will have type inference for local variables, so you won't
have to do that anymore.
And when foreach executes, it is for every element up to x, not
the number of populated elements.
=20

That's the behaviour of ArrayList too. Ruby's Arrays compensate this
with the quirk that out-of-bounds access silently returns nil. (Although
I think there's a method with a stricter approach to this.
Is there and elegant way in C# to append members into an array, and
execute foreach for each populated member? Or do I have to code my own=
extensions to class array such that it acts like Ruby? Has someone
already done this in C#?
=20

Use. ArrayLists. Changing class array won't help anything, because
they're a first-class primitive datatype. Ruby doesn't have an
equivalent to them, because it uses C arrays as backing storage.

Also, C# 2.0 has lambdas. C# 3.0 will let you add methods to external
classes. I'd be very, very surprised if there isn't a library that can
do each/select/collect/inject for C# 3.0 already, unless .NET 3.0 adds
that in the framework itself. I don't follow happenings in dotnetland,
so I can't tell.
Once again, I can't express my appreciation enough. I'm thinking of
learning C# for my company, but still implement everything in Ruby
anyway. Hell, I can prototype production ready code in Ruby so much
faster than I can translate it to C#.
=20

While Ruby fluffs are always welcome, accompanying them with an
ill-informed rant makes them taste so bitter. And if the ill-informed
rant is a flame at another programming language with a completely
different audience / area of application, their value approaches zero.

David Vallner


--------------enigC6C0316FF5D06DBA5146AD50
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFU53iy6MhrS8astoRAmNLAJ4y9wfTkrcAd/LvEsjeBEh38H4WUQCfV8uR
Zju8WE9clyXYSUlYAt6egFg=
=KAji
-----END PGP SIGNATURE-----

--------------enigC6C0316FF5D06DBA5146AD50--
 
D

David Vallner

--------------enigA0725C2FEE383753A5F0B71E
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Leslie said:
Just saw Qt4 with Ruby bindings... maybe the wait is over!
=20

No win32 maintainers. WOE.

David Vallner


--------------enigA0725C2FEE383753A5F0B71E
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFU54Iy6MhrS8astoRAnNeAJ0RUD94yDLZzFlEBPvHk1vjQ/nozACfVTe5
Nf2LaRIitxNgK8KTlYE0cys=
=BGh/
-----END PGP SIGNATURE-----

--------------enigA0725C2FEE383753A5F0B71E--
 
D

David Vallner

--------------enig26F1ACD1532EE9853AAB1E23
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
You can play with some of the array manipulation features you mentioned=
downloading LINQ (Language Integrated Query).

LINQ is an abomination, and a marketing scam to make Transact SQL coders
switch over. It's horrid abuse of a relational programming language to
handle object-oriented data, and will at best only lead to wider
adoption of the "let's transfer all data from the DB in-process and
handle them there" school of thought. Lambdas and method calls feel just
so very much cleaner in OO code, the SQL-ish syntax looks out of place
and mostly clutters things. And you shouldn't do joins on OO data anyway
because those things will kill your performance unless optimised, which
DBs tend to do better (since the query engine monitors data on input and
can prepare for queries, unlike LINQ which has to work with arbitrary
structures.)

End completely unrelated rant.

David Vallner


--------------enig26F1ACD1532EE9853AAB1E23
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFU59gy6MhrS8astoRAsAvAJ9iUKGCTzaB5NENmFb7jFXIVmnyggCeKAXZ
6opYl31fnS7VuEh1A3i4wh8=
=QJHp
-----END PGP SIGNATURE-----

--------------enig26F1ACD1532EE9853AAB1E23--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Hello all 1
Hi all 0
Site Migration Ruined all my CSS?? 8
Kudos! 4
How to start, if at all ? 2
Hello to all! 1
kudos 0
How to loop in folder through all excel files and all sheets using pandas? 0

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top