You are not logged in.
Pages: 1
Okay, this should sum up my question nicely. It's the sizes of the tarred and gzipped binary packages for various languages, in order of decreasing size:
j2re - 29.3 MB
mono - 20.2 MB
perl - 11.8 MB
python - 9.9 MB
ruby - 2.4 MB
Does Ruby lack a lot of the features found in Perl and Python, or something?
Offline
no, it just just made far cleaner than the other languages, and lacks some libraries I believe.
Offline
I dont think that Ruby has a standard library as big and complete as that of python.
iphitus
Offline
I agree - the language itself is well featured, but not as many modules included as Perl and Python.
Mono and Java contain a massive core API. Java includes its own GUI toolkit (2 in fact, AWT for applets and Swing for desktop apps) and Mono presumably comes with its gtk bindings.
Offline
Maybe one needs to compare just the binary interpreters for a better "size" comparison - /usr/bin/ruby, et al
Offline
right. Ruby includes things in the stdlib that make relative sense. If you need more functionality, you can use ruby gems. Gems is a system much like cpan.
Ruby also doesn't have alot of the cruft libraries that python has--old interfaces and such that are deprecated, but still hanging on..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
On the other hand it makes it easier to deploy Python apps than Ruby ones (I guess).
Some PKGBUILDs: http://members.lycos.co.uk/sweiss3
Offline
I suppose that argument could be made, and is indeed valid.
I guess I prefer a slightly smaller base package, with addons "as needed" for functionality above and beyond the norm.That is likely what drew me arch in the first place.To me, Ruby typifies the simplicity that I seek.
The "Ruby Way" and the "Arch Way" share facets that I find speak to the soul of my developer self. To each their own though. That is why there are mulitple languages and design constructs.
If we all thought the same, there would be little beauty in the world.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Is Ruby as easy to learn as Python? Can you start using it right away?
I don't care much about the size of a package because I don't think it's an issue any longer, now that we have broadband and all that. Maybe Java really is monstrous, but it makes deployment a breeze for the developers. As long as the language is kept clean (not too many builtin stuff and keywords) I think it'll work nicely.
And if anyone wants a summary - Python rocks, Ruby rocks. And ask Dusty about Java.
Some PKGBUILDs: http://members.lycos.co.uk/sweiss3
Offline
Is Ruby as easy to learn as Python? Can you start using it right away?
I used both, and I would say that they are close to ease of learning. For a new programmer with no previous programming experience, it *might* be easier to pick up python. For anyone who has programmed anything before (even vb...lol) they are probably both equally easy to learn.
http://poignantguide.net/ruby/
http://www.rubycentral.com/book/
http://wiki.python.org/moin/BeginnersGuide
http://diveintopython.org/
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
What I love in python is the simplicity of dynamicly modfiying classes and in general all the information you can gain about objects at runtime. Is there something similar to ruby?
Offline
http://www.ruby-doc.org/stdlib/
Here is the reference of the ruby standard library. I never felt there was anything missing that would warrant being included with all distributions of ruby.
Offline
sweiss wrote:Is Ruby as easy to learn as Python? Can you start using it right away?
I used both, and I would say that they are close to ease of learning. For a new programmer with no previous programming experience, it *might* be easier to pick up python. For anyone who has programmed anything before (even vb...lol) they are probably both equally easy to learn.
http://poignantguide.net/ruby/
http://www.rubycentral.com/book/http://wiki.python.org/moin/BeginnersGuide
http://diveintopython.org/
Thanks for the guides. Though I must say things like "puts" and "3.times" are pretty weird looking.
Some PKGBUILDs: http://members.lycos.co.uk/sweiss3
Offline
Thanks for the guides. Though I must say things like "puts" and "3.times" are pretty weird looking.
Yeah, the 5.method thing gets me alot, but I think that's valid in alot of languages (javascript?) - puts is actually the name of the C function to output a constant string (though everyone uses printf, which is dumb).
The one thing I *hate* is the "puts" abbreviation (like it needs an abbreviation)
p 5
Offline
I think I'll try to master Python still rather than starting with something new then
Some PKGBUILDs: http://members.lycos.co.uk/sweiss3
Offline
The one thing I *hate* is the "puts" abbreviation (like it needs an abbreviation)
p 5
Actually, it's not an abbreviation. p calls the objects .inspect method to produce a more meaningful output. In that sense, it's really used as a debugging tool (perhaps in irb, that would explain its brevity). puts, on the other hand calls the objects to_s method, which may not be the ideal thing.
For an example, try this:
a = [1, 2, [3,4]]
p a
puts a
Array's to_s has no clue what to do, so it just propagates the to_s message to its members. inspect, on the other hand, tries to produce a more meaningful result.
As for the closures, they are definitely the most useful thing in the language, although the .times method is the least useful example. You could also write a loop like
for i in 1..10 do
puts i
end
or 1.upto(10) {|i|
puts i
}
Its truly useful applications come with various .each, .collect, .inject, as wel as the neat way of dealing with I/O objects.
-end rant-
Offline
I think I only miss real closures from python, these expression-lambdas are a bit useless.
Offline
I think I only miss real closures from python, these expression-lambdas are a bit useless.
Eh? Mind explaining this a bit more?
Offline
in python you can use lambda args: expression, to create sth. like a closure, but it can only contain one expression, not a block.
example:
lambda x,y: x+y
def add(x,y):
return x + y
these are the same, but if you want to set a member of a class to a value, you can't use obj.a = 2, because this is a statement, so you have to use tricks, like lambda: setattr(sefl, "a", 2).
but as I think about it, it's not that bad, because you can allways define a function (even inside a function), but still I would love a bit more stronger lambdas.
Offline
but as I think about it, it's not that bad, because you can allways define a function (even inside a function), but still I would love a bit more stronger lambdas.
Your issue seems to be with anonymous closures... "named" closures (what you said, create a function and throw it in a lambda) are easier.
It looks to me like this is by deisgn.
Offline
in python you can use lambda args: expression, to create sth. like a closure, but it can only contain one expression, not a block.
example:lambda x,y: x+y def add(x,y): return x + y
these are the same, but if you want to set a member of a class to a value, you can't use obj.a = 2, because this is a statement, so you have to use tricks, like lambda: setattr(sefl, "a", 2).
but as I think about it, it's not that bad, because you can allways define a function (even inside a function), but still I would love a bit more stronger lambdas.
Oh, I see. I sort of misinterpreted your comment then .
So, once you create a named function, can you pass it to other functions and will it preserve the binding like when it was initially created?
Offline
do you mean something like this:
>>> class Test:
... def do(self):
... print "hallo"
...
>>> def test(a,b):
... def sub():
... print a
... b.do()
... return sub
...
>>> s = test("hallo", Test())
>>> s()
hallo
hallo
Offline
do you mean something like this:
>>> class Test: ... def do(self): ... print "hallo" ... >>> def test(a,b): ... def sub(): ... print a ... b.do() ... return sub ... >>> s = test("hallo", Test()) >>> s() hallo hallo
Yes, that's basically "C function pointer" functionality. However, what is really cool about closures in Ruby is that they get bound to the context they were defined in. For instance, doing something like:
a = 100
p = lambda {
a
}
puts p.call()
will output 100. And any other time you call this function, you will get 100.
There is a small trick though: the closure remembers the binding references. It does not keep actual data. In case of fixnums, changing a later wouldn't make any change, but things could get complicated with other data.
This memory of the "context" of the closure is what makes it a real "closure".
So, I suppose, my question was if Python supported this sort of functionality.
Offline
as you can see python has this functionality. a,b are contained in the scoped of the outer funktion (test) and are bound to the scope of the inner function (sub). and they remain bound even if the scope of the outer function is left.
another example:
>>> def test():
... l = list()
... def sub():
... return l
... return sub
...
>>> s = test()
>>> s
<function sub at 0x40065f0c>
>>> s()
[]
or your example:
>>> def test():
... a = 100
... def p():
... return a
... return p
...
>>> p = test()
>>> print p()
100
Offline
Pages: 1