New project, "Code to Code"

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Dec 17 20:11:49 UTC 2008


On Wed, Dec 17, 2008 at 02:30:55PM -0500, Marc Lanctot wrote:
> Honestly, how many languages differ in the semantics and expected usage 
> of a for loop? It's not like someone trying to learn a completely 
> different programming paradigm would cross between paradigms (eg. 
> imperative to functional programming) .. that's just not what the tool 
> is meant to accomplish.

In some languages you are much better off doing a map of a function onto
a list of data rather than looping over the data.

Doing switch statements in perl simply isn't going to happen, while some
other languages has such a concept.

> And, even if someone would do something like this, there should be user 
> contributed notes attached to each translation.. following my example 
> "Note: In LISP a better way to do a for loop is to do <<insert crazy 
> recursive functional construct>>".

That's why I think in many cases even considering doing something a
certain way is just plain wrong for a given language.

> Are you implying that a for loop is a bad habit in any language? :) A 
> programmer's style comes from the programmer, not his/her reference tools.

Yeah it is.  Most of the time when you do a for loop what you really
meant to say was 'do this to each item in this array', so that's what
you should have told it rather than use a for loop.  Unfortunately
languages like C don't have any such construct and you are left with
using a crappy for loop.  With the nifty way to do it the language could
have parallelized it for you across lots of CPUs.  With the for loop it
is purely serial code and any parallelism comes down to the skill of the
programmer (where unfortunately most aren't that capable because it is
seriously hard to do right and especially hard to do well.)

> At least the way I see it this tool would be used as a reference for 
> things that you don't remember how to do in one language because you're 
> not used to working in it. Example: "aw man, how do you get the length 
> of a string in Python" ? You can avoid the Google search and browsing 
> through non-standardized pages to find the info you need.

That would certainly help at times.

> I've worked with Java for years that I became an expert and didn't need 
> any reference. The last two years I've been working with C++ and I've 
> needed to do these kind of look-ups. This happens all the time for 
> programmers so there is a need for a tool like this.

So far I have avoided java and I hope to continue that trend. :)  I have
even managed to avoid c++ for a number of years now.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list