Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 395 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python vs. Ruby for metaprogramming

#11
## What about OCaml ? ##

OCaml features: a static type system, type inference, parametric polymorphism, tail recursion, pattern matching, first class lexical closures, functors (parametric modules), exception handling, and incremental generational automatic garbage collection.

I think that it satisfies the following:
>Important:
>
> 2. Nice, clean, sane syntax and consistent, intuitive semantics. Basically a well thought-out, fun to use, modern language.
> 3. Multiple paradigms. No one paradigm is right for every project, or even every small subproblem within a project.
> 4. An interesting language that actually affects the way one thinks about programming.
>
>Somewhat important:
>
> 1. Performance. It would be nice if performance was decent, but when performance is a real priority, I'll use D instead.
> 2. Well-documented.
Reply

#12
Ruby would be better than Lisp in terms of being "mainstream" (whatever that *really* means, but one realistic concern is how easy it would be to find answers to your questions on Lisp programming if you were to go with that.) In any case, I found Ruby very easy to pick up. In the same amount of time that I had spent first learning Python (or other languages for that matter), I was soon writing *better* code much *more efficiently* than I ever had before. That's just one person's opinion, though; take it with a grain of salt, I guess. I know much more about Ruby at this point than I do Python or Lisp, but you should know that I was a Python person for quite a while before I switched.

Lisp is definitely quite cool and worth looking into; as you said, the size of community, etc. can change quite quickly. That being said, the size itself isn't as important as the *quality* of the community. For example, the `#ruby-lang` channel is still filled with some incredibly smart people. Lisp seems to attract some really smart people too. I can't speak much about the Python community as I don't have a lot of firsthand experience, but it seems to be "too big" sometimes. (I remember people being quite rude on their IRC channel, and from what I've heard from friends that are really into Python, that seems to be the rule rather than the exception.)

Anyway, some resources that you might find useful are:

1) The Pragmatic Programmers Ruby Metaprogramming series (

[To see links please register here]

) -- not free, but the later episodes are quite intriguing. (The code is free, if you want to download it and see what you'd be learning about.)

2) On Lisp by Paul Graham (

[To see links please register here]

). It's a little old, but it's a classic (and downloadable for free).
Reply

#13
Concerning your main-point (meta-programming):
Version 1.6 of Groovy has AST (Abstract Syntax Tree) programming built-in as a standard and integrated feature.
Ruby has RubyParser, but it's an add-on.


Reply

#14
> one that supports the metaprogramming hacks that just **can't be done in a statically compiled language**
>
> I would love to find a language that allows some of the cool stuff that **Lisp** does

Lisp can be compiled.
Reply

#15
Go with JS just check out AJS (Alternative JavaScript Syntax) at my github

[To see links please register here]

it will give you some cleaner looking closures etc :D
Reply

#16
Compare [code examples][1] that do the same thing (join with a newline non-empty descriptions of items from a `myList` list) in different languages (languages are arranged in reverse-alphabetic order):

**Ruby**:

myList.collect { |f| f.description }.select { |d| d != "" }.join("\n")

Or

myList.map(&:description).reject(&:empty?).join("\n")

**Python**:

descriptions = (f.description() for f in mylist)
"\n".join(filter(len, descriptions))
Or

"\n".join(f.description() for f in mylist if f.description())

**Perl**:

join "\n", grep { $_ } map { $_->description } @myList;
Or

join "\n", grep /./, map { $_->description } @myList;

**Javascript**:

myList.map(function(e) e.description())
.filter(function(e) e).join("\n")

**Io**:

myList collect(description) select(!="") join("\n")

Here's an [Io guide][2].


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#17
if you love the rose, you have to learn to live with the thorns :)
Reply

#18
Io satisfies all of your "Important" points. I don't think there's a better language out there for doing crazy meta hackery.
Reply

#19
Well, if you don't like the lisp syntax perhaps assembler is the way to go. :-)

It certainly has minimal distinction between code and data, is multi-paradigm (or maybe that is no-paradigm) and it's a mind expanding (if tedious) experience both in terms of the learning and the tricks you can do.
Reply

#20
Lisp satisfies all your criteria, including performance, and it is the only language that doesn't have (strange) syntax. If you eschew it on such an astoundingly ill-informed/wrong-headed basis and consequently miss out on the experience of using e.g. Emacs+SLIME+CL, you'll be doing yourself a great disservice.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through