Click to See Complete Forum and Search --> : Short, sweet and safe
Gnu/Vince
10-18-2001, 07:01 PM
What are the languages who allow safe programming while still having code that's pretty short (you don't need to spend 10 lines to regulate one situation) and that is easy to understand?
Right now, I think Ruby and Python fall into that category. Anything else?
[ 18 October 2001: Message edited by: Gnu/Vince ]
bwkaz
10-18-2001, 10:09 PM
Java, sort of, and depending. It's not that short, and it's definitely not easy if you've never used it or C or C++ before.
But if you have used C/C++, then Java is quite a bit easier to understand. The length, though, probably keeps it out of the category. It depends where exactly the "number of lines needed to regulate one situation" limit gets set at -- 35 would make it short, while 5-10 probably wouldn't.
klamath
10-18-2001, 11:29 PM
I think Java's pretty easy, but it's also really verbose. In particular, some features (like anonymous inner classes) were kinda bolted on to the language afterwards and are pretty clumsy.
What do you mean by 'safe'?
jemfinch
10-18-2001, 11:32 PM
Ocaml is very safe (more so than Perl or Ruby or Python) and has nearly
the same code economy as Python or Ruby (I'll take the Pepsi challenge with
anyone who wants to disagree :))
Oh, and classifying Perl as "easy to read" is a bit extreme...
Jeremy
[ 18 October 2001: Message edited by: jemfinch ]
Gnu/Vince
10-18-2001, 11:58 PM
Originally posted by klamath:
<STRONG>I think Java's pretty easy, but it's also really verbose. In particular, some features (like anonymous inner classes) were kinda bolted on to the language afterwards and are pretty clumsy.
What do you mean by 'safe'?</STRONG>
Safe? Well, that it puts condom :) Seriously, by safe I mean that the program is pretty much immune to buffer overflows, mega-idiot users.
[ 19 October 2001: Message edited by: Gnu/Vince ]
Gnu/Vince
10-19-2001, 12:01 AM
Originally posted by jemfinch:
<STRONG>Ocaml is very safe (more so than Perl or Ruby or Python) and has nearly
the same code economy as Python or Ruby (I'll take the Pepsi challenge with
anyone who wants to disagree :))
Oh, and classifying Perl as "easy to read" is a bit extreme...
And I think that Ocaml is as worse as Python in the readability field.
Jeremy
[ 18 October 2001: Message edited by: jemfinch ]</STRONG>
My bad. I meant Python... I fixed that.
[ 19 October 2001: Message edited by: Gnu/Vince ]
debiandude
10-19-2001, 12:14 AM
Why does everyone say perl is so complicated to read. Personally I though it was the easiest language I've every tried to learn. The syntax is a no-brainer. The only thing that took a little time to learn was regex, and once you got that you can do so many things very efficently. Perhaps, $1 and $' and $[ or (?.*) things are a little hard to grasp at first because they are symbols versus words, but after a while they just stick in becuaes your brain thinks in pictures not works anyway. I dunno, I like perl, and I think that anyone who seriously gives it about two weeks can pretty much do anything. I certainlly couldn't say the same thing about C or java.
klamath
10-19-2001, 12:22 AM
Why does everyone say perl is so complicated to read
My main complaint with Perl syntax is that OO Perl is horrible. The syntax of the core language is okay, although it's pretty messy.
Ocaml is very safe
Damn, I've been meaning to get back to learning that. Too little time, though. Do you know if there are any OCaml books in the works (I saw a note about translator for a book, IIRC by O'Reilly, on the ocaml list a couple days ago, which is a good sign).
Gnu/Vince
10-19-2001, 01:09 AM
Originally posted by klamath:
<STRONG>Damn, I've been meaning to get back to learning that. Too little time, though. Do you know if there are any OCaml books in the works (I saw a note about translator for a book, IIRC by O'Reilly, on the ocaml list a couple days ago, which is a good sign).</STRONG>
Yeah, I want a good book on Ocaml too. book.pdf is good, but it goes too fast for my taste.
jemfinch
10-19-2001, 02:01 AM
Originally posted by debiandude:
Why does everyone say perl is so complicated to read.
Because there are a bazillion ways to do the simplest things, and the semantics
of a statement/expression can change on the very slightest differences.
Personally I though it was the easiest language I've every tried to learn. The syntax is a no-brainer.
If you don't think Perl isn't a wild collection of special cases and unpredictable
semantics, you haven't dug very deep into it.
Jeremy
jemfinch
10-19-2001, 02:05 AM
Originally posted by klamath:
Damn, I've been meaning to get back to learning that. Too little time, though. Do you know if there are any OCaml books in the works (I saw a note about translator for a book, IIRC by O'Reilly, on the ocaml list a couple days ago, which is a good sign).
Yeah, I offered to be a proofreader on that project, and most likely will
begin within a few weeks. I'll definitely be working as hard as possible to get
it proofread so it can be printed ASAP :)
Jeremy
Gnu/Vince
10-19-2001, 10:52 AM
klamath and Jeremy: I can read french (duh!), so if you need something, I could probably take the part which interests you in the french version of the book and translate it for you.
klamath
10-19-2001, 11:36 AM
Gnu/Vince: Thanks for the offer; if you're interested in proofreading, I'd suggest helping out with the project mentioned on the ocaml list a couple days ago. I'm happy to wait for that to finish, so no need to translate anything just for me ;-)
Gnu/Vince
10-19-2001, 11:39 AM
Originally posted by klamath:
<STRONG>Gnu/Vince: Thanks for the offer; if you're interested in proofreading, I'd suggest helping out with the project mentioned on the ocaml list a couple days ago. I'm happy to wait for that to finish, so no need to translate anything just for me ;-)</STRONG>
Nah, I'm not good enough at ocaml yet to do that
sans-hubris
10-19-2001, 11:44 AM
Originally posted by debiandude:
<STRONG>Why does everyone say perl is so complicated to read.</STRONG> It can be with a bad programmer, but that's true for almost any language.
Anyway, I think that C++ is a good compromise between being low level(like C), succintity, and safety (class constructors and destructors with delete for dynamically allocated objects are a blessing compared to malloc.)
Gnu/Vince
10-19-2001, 03:01 PM
Originally posted by debiandude:
<STRONG>Why does everyone say perl is so complicated to read. </STRONG>
http://www.detonate.net/protected/matrixse/18/6.jpg
slacker_x
10-19-2001, 05:03 PM
hehehe
That's a good one :D
debiandude
10-19-2001, 05:19 PM
If you don't think Perl isn't a wild collection of special cases and unpredictable
semantics, you haven't dug very deep into it.
It never ceases to amaze me how people in this board can make such blanket statements such as yours. Perhaps, you have not given Perl enough of a chance, becuase I certainally don't feel that Perl is some wild jungle where a tree one day is a snake the next. What are these unpredictabilites of which you speak. Perhaps, I am ignorant, and if you wish enlighten me, do so. However, don't expect people to be as staunch as you seem to be against the utility of Perl.
[ 19 October 2001: Message edited by: debiandude ]
jemfinch
10-20-2001, 01:09 AM
Originally posted by debiandude:
It never ceases to amaze me how people in this board can make such blanket statements such as yours. Perhaps, you have not given Perl enough of a chance, becuase I certainally don't feel that Perl is some wild jungle where a tree one day is a snake the next. What are these unpredictabilites of which you speak. Perhaps, I am ignorant, and if you wish enlighten me, do so. However, don't expect people to be as staunch as you seem to be against the utility of Perl.
Not given Perl enough of a chance?
I know Perl. It used to be my favorite language. I can still read well
written Perl and understand it, even translate it into other languages (like
O'Caml) fairly easily (which I did with Text::Soundex, in fact.) I still answer
questions about it when they're asked here.
That doesn't mean Perl doesn't suck. That doesn't mean its semantics aren't
still horribly inconsistent, that doesn't mean that 10 programmers won't still
write the same program in 10 wildly varying manners. It doesn't mean that Perl
doesn't <A HREF="http://www.underlevel.net/jordan/erik-perl.txt" TARGET=_blank> "reward
idiotic behavior in a way that no other language or tool has ever done"</A>.
In short, for all but the most trivial text filtering task, there exists a more
appropriate language than Perl.
Jeremy
PS.: I had a link to a good example of Perl's unpredictable semantics, but I
lost it. I'll keep an eye out for it. In the meantime, perhaps you should
learn Python and compare the two...we'll see if you switch to Python before I
find the link :)
debiandude
10-20-2001, 04:44 PM
I always thought that the main strength of Perl was that there are so many different ways to write the same thing. I never considered that a weakness to the language. So is this what you mean by varying semantics:
#!/usr/bin/perl -wl
print 2;$_ = 1;
(1x$_) !~ /^(11+)\1+$/ && print while $_+=2;
and the same written:
#!/usr/bin/perl -w
my $prime = 1;
while($prime++) {
if((1x$prime) !~ m/^(11+)\1+$/) {
print $prime, "\n";
}
}
[ 20 October 2001: Message edited by: debiandude ]
Gnu/Vince
10-20-2001, 09:15 PM
Originally posted by debiandude:
<STRONG>
(1x$_) !~ /^(11+)\1+$/ && print while $_+=2;
</STRONG>
You can read that?! Wow! You must always write in l33t speech also! That's why Python and Ruby are getting more and more popular: they are not that cryptic.
Ladies and Gentlemen, Esteemed Colleagues, I proudly present you... HelloWorld in BRAIN****!
>++>+++++++[<++++++++++>-]<.+++++++++>++[<++++++++++>-]<.+++++++..+++.-------
>++++++[<---------->-]<.------------.+++++>+++++[<++++++++++>-]<.++++>++[<+++
+++++++>-]<.+++.------.--------.+++>+++++++[<---------->-]<.
So, quitcher*****ing about perl :)
debiandude
10-20-2001, 11:18 PM
First that was not meant to scare anyone away from perl, its certainally not something you will probably ever see. I was trying to see if that was what jemfinch meant, those types of differences.
Oh and I don't talk in l33t speech. :)
Is that brain**** a real thing!?!
[ 20 October 2001: Message edited by: debiandude ]
Yes, it's an 8 command turing complete language, first implemented in 284 bytes of C.
scary, eh?
i believe someone was bored and decided they wanted to write a full featured compiler in as little c as possible.
sans-hubris
10-21-2001, 03:05 AM
http://www.muppetlabs.com/~breadbox/bf/