Home
Monday, July 24, 2017
10:52:46 PM
Users online: 0   You are here >> Home > Programming

Forums | Programming Forums search
Forum FAQ
   
 Previous Page 1 | 2  
Perl or Python?
über-Bantumi 
12/8/08 3:16:27 PM
Titan

I can't believe I'm going to be the first to advocate Perl...

Seriously, white space as syntax? Uggggh!

-----
Green rooms = no

Girvo 
12/8/08 6:31:40 PM
Immortal

Hence Ruby, Bantumi :P


It's Perl, but nice.

-----
Quote by Disco
Edit: I got my own age wrong? o_0



zephyr 
12/8/08 9:51:18 PM
Hero
Titan


Quote by über-Bantumi
I can't believe I'm going to be the first to advocate Perl...

Seriously, white space as syntax? Uggggh!



whitespace syntax is better than #$!_%<@$ soup :-p

-----
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in. We're computer professionals. We cause accidents. (N. Borenstein)

über-Bantumi 
14/8/08 10:13:59 PM
Titan

Is Ruby actually that nice? I'm yet to open it up yet, but I have workmates who really really detest it. Just stuck in their ways? ;)

-----
Green rooms = no

hetman 
14/8/08 10:54:32 PM
Hero
Titan


That depends... what languages do they advocate? There's a guy at work who hates Python and would code everything in C++ if management let him. I'll go with the "stuck in his ways" theory in that case :)

-----
Wystarczy tego medrkowania.

dave_blob 
14/8/08 11:01:04 PM
Guru

Go for ruby!

Its really very nice to write in. I find myself using it for everything I can, even for things I probably shouldnt(win32ole intergration with excel, for example! :p)

-dave


EDIT:
Dont use it if you need super quick performance though, matz' interpreter is quite slow. Although, JRuby is much much faster, and almost drop in compatible.



Edited by dave_blob: 14/8/2008 11:07:02 PM

-----
Your comeback shames me

Phelan:
You exist. You are born and you die. That's it.
What matters is life before death - enjoy your time here, be nice to others and have some fun.

hetman 
14/8/08 11:23:10 PM
Hero
Titan


True, but Ruby 1.8 is only about 50% slower than CPython. Given that both languages suck for speed compared to something like C++, I doubt it makes a real difference.

The intepreters I'm really excited about are YARV (slightly faster than CPython) and Rubinius... which is already matching Ruby 1.8 and making awesome progress.

What I find more important for slow dynamic languages is how quickly I can mould my code (i.e. development speed not execution speed)... and Python is sometimes a letdown for me here.

-----
Wystarczy tego medrkowania.

dave_blob 
14/8/08 11:39:33 PM
Guru

Quote by hetman
True, but Ruby 1.8 is only about 50% slower than CPython. Given that both languages suck for speed compared to something like C++, I doubt it makes a real difference.

The intepreters I'm really excited about are YARV (slightly faster than CPython) and Rubinius... which is already matching Ruby 1.8 and making awesome progress.




I don't know if you've read this, but its a fascinating rundown of the state of all the alternative ruby implementations & technologies involved. Well worth the read.

http://blog.headius.com/2008/04/promise-and-peril-for-alternative-ruby.html

-----
Your comeback shames me

Phelan:
You exist. You are born and you die. That's it.
What matters is life before death - enjoy your time here, be nice to others and have some fun.

über-Bantumi 
15/8/08 9:19:53 PM
Titan

Well... devs in my team use almost exclusively Perl, with some scattered Java and C for 'legacy' applications. Personally I use perl and basically regex where I can in bash or our other management apps (most allow it for queries etc)

Can I just dump C into Ruby?

-----
Green rooms = no

nicephotog-jvm.net 
17/8/08 12:25:16 PM
Master

One of the weirdest i ever saw was a program to convert javascript
to DLL and EXE . Its out there on the net somewhere but "converter"
programs exist for various languages, ASPN perl is what you would
look up for GUI in perl.

-----
NIN - Reptile (Reciprocating Marine engine)

dave_blob 
18/8/08 11:37:58 AM
Guru

Quote by über-Bantumi
Well... devs in my team use almost exclusively Perl, with some scattered Java and C for 'legacy' applications. Personally I use perl and basically regex where I can in bash or our other management apps (most allow it for queries etc)

Can I just dump C into Ruby?



If by 'dump C into ruby' you mean write inline C code directly into a ruby program, then no. It is an interpreted language, and C is compiled, so you need to do something a bit fancier.

There is a plugin that will let you do that:
http://lojic.com/blog/2007/10/05/inline-c-code-in-ruby/

It probably complies the C code at Class instantiation time.

Otherwise, if you want to do it properly, its not very hard to make a ruby interface to an existing C program:
http://www.onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html

-----
Your comeback shames me

Phelan:
You exist. You are born and you die. That's it.
What matters is life before death - enjoy your time here, be nice to others and have some fun.

hetman 
18/8/08 11:13:17 PM
Hero
Titan


Rubyinline I think is pretty much spot-on for inlining C in your code. You can set it up with any compiler you like. It will compile the C bits the first time the program loads and then link to the binary on subsequent runs.

The Ruby C API is probably a better idea anyway though. It's quite straightforward; I find it feels a lot like just writing Ruby with C syntax (much more so than the Python C API does for Python). It's a great way to whip bits of your Ruby program in C. No idea how it compares to Perl's C API though (I'm assuming it's pretty much guaranteed to have one here but don't actually know :)

Edit: dave_blob - yeh I saw that article not too long ago. Fascinating read.


Edited by hetman: 18/8/2008 11:14:24 PM

-----
Wystarczy tego medrkowania.

über-Bantumi 
19/8/08 7:56:01 PM
Titan

Thanks guys, as I said before I've never really looked into it. Something to check out when work quietens down over christmas...

I'm just reading that article now...

Finally, is Ruby TMTOWTDI? ;)

-----
Green rooms = no

dave_blob 
20/8/08 10:32:44 AM
Guru

Quote by über-Bantumi

Finally, is Ruby TMTOWTDI? ;)



yes.
Which is one of the only aspects of the language im a little uncomfortable with. Some things can be done *many* different ways, sometimes creating unnessecary confusion. One of the best examples of where this makes a mess is the proc/block/lambda/whatever first class function constructs. Theres like 7 differnt ways to do it, and the differences between are sutble and to my mind totally unnessecary.

-----
Your comeback shames me

Phelan:
You exist. You are born and you die. That's it.
What matters is life before death - enjoy your time here, be nice to others and have some fun.

hetman 
20/8/08 7:46:27 PM
Hero
Titan


Yes! Because we shouldn't have to conform to the mundane orthogonality of the machine when interacting with it. That's why ruby has an "unless" next to "if" has statement modifiers for those, has a "case" statement etc.

I have hardcore Python programmers at work who sometimes complain about the lack of "unless" "case" and "?:" in Python. What can I say :)

As far as closures go, proc is older, lambda is better... just stick with the newer construct. The crap version will fall out of use eventually and it's all getting shaped up even tighter in Ruby 1.9.

-----
Wystarczy tego medrkowania.

freespace 
22/8/08 10:20:17 PM
Hero
Titan


?: is coming to a python, case should be implemented with dictionaries, unless, not sure :)

-----
By perseverance the snail reached the ark.

http://www.shuningbian.net - blog
http://anonshare.pictorii.com - share files anonymously
http://dailydiscovery.b3ta.org - learn something new
its f reespace damn it!

hetman 
31/8/08 1:34:20 PM
Hero
Titan


If you're on python 2.5 you can use: true_val if predicate else false_val equivalent to predicate ? true_val : false_val .

I'm sure we'd dissagree about neatness but it's not so bad :) I think we can both agree dicts are an inadequate solution for case without anonymous functions and even then it would be an ugly ugly hack.

There was a guy at work who would always write "if not x == y" in his code... I think his subconscious yearned for an unless ;)

I just get annoyed every time I have to do a song and dance for Python just so I can use moderately sophisticated OO constructs (ah the joys of descriptors and Python metaclasses).

-----
Wystarczy tego medrkowania.

 Previous Page 1 | 2  
Forums | Programming