seemingly cool languages with one(+) major hindrance (26)

1 Name: MAD-Leser!r4YvKJpWUc 05/01/01(Sat)01:59 ID:5Ui671SK [Del]

this board needs more threads. i'm currently trying to fight my way around ocaml and am kind of astonished at the syntax. i, being used to c/c++/ruby/perl conventions, find myself more or less lost even in what seems like a simple snippet of code. at first, i became interested in ocaml because i heard it was right behind c in terms of performace while providing the programmer with bound checking, a garbage collector, OO, and other neat features like type inference, where the compiler guesses the type of the variable by means of looking at what is done with it. some tiny examples, taken from the first 2 chapters of http://merjis.com/developers/ocaml_tutorial/, "Learning OCaml, for C, C++, Perl and Java programmers":

> let average a b =
> (a +. b) /. 2.0;;

this defines a function "average", which takes 2 floats as arguments and returns the average of them. "+." and "/." are operators acting on floating point thingies, there is no such thing as implicit casting.

> The standard phrase "let name = expression in" is used to define a named
> local expression. [...]
> The C variable sum has a slot allocated for it on the stack. You can
> assign to sum later in the function if you want, or even take the
> address of sum. This is NOT true for the OCaml version. In the OCaml
> version, sum is just a shorthand name for the expression a +. b. There
> is no way to assign to sum or change its value in any way. [...] Here's
> another example to make this clearer:
> [...]
> let f a b =
> let x = a +. b in
> x +. x ** 2.
> ;;
> The ; is an operator, just like + is. Well, not quite just like + is,
> but conceptually the same. + has type int -> int -> int - it takes two
> ints and returns an int (the sum). ; has type unit -> 'b -> 'b - it
> takes two values and simply returns the second one. Rather like C's ,
> (comma) operator. You can write a ; b ; c ; d just as easily as you
> can write a + b + c + d.

yarrr >_>. read chapter 2 for more of this kind of stuff. things like nested functions, global definitions, some real code examples, "; vs ;; vs none" and assignement of "real" variables await you. check http://en.wikipedia.org/wiki/Ocaml for an ocaml implementation of "99 Bottles of Beer" :O.

anyone up to share his experience with languages which left you mystified or feeling stupid?

2 Name: Albright!LC/IWhc3yc 05/01/01(Sat)04:57 ID:flKklSxK [Del]

Perl. When I look at Perl code, it's almost at the level where I really just don't even want to try to understand it. Stuff like where there's an "if" clause after the action the program should take if it's true...

But this OCaml looks almost as horrific... Why are you subjecting yourself to it?! If you already know C and are looking for another lang which has OO and other goodies, have you considered Objective C?

3 Name: CYB3R H4XX0R G33K 05/01/01(Sat)06:09 ID:q5z/pRp4 [Del]

$ perl -e 'print ">>2 = DQN\n" if $ObjectiveC eq $Crap;'
>>2 = DQN
$

4 Post deleted by user.

5 Name: Albright!LC/IWhc3yc 05/01/01(Sat)09:22 ID:Heaven [Del]

>>3: Thank you for your post. Your contribution to the topic at hand is immeasurable.

6 Post deleted by user.

7 Name: dmpk2k!hinhT6kz2E 05/01/01(Sat)10:17 ID:T3Ri7BZ2 [Del]

Unlambda or Malbolge. I made the mistake of talking weird languages with WAHa once, and he had those little nuggets of evil tucked away.

I guarantee you've never seen languages this bad.

8 Name: !WAHa.06x36 05/01/01(Sat)12:44 ID:mCQI/LGv [Del]

>>2

"if" after the expression seems strange at first when you're used to C, until you realize it's just English: "Do this, if that". The "unless" construct makes it even easier to read your code out loud. $name="Anonymous" unless($name) - "Set $name to Anonymous unless there's a name already".

9 Name: !WAHa.06x36 05/01/01(Sat)12:52 ID:mCQI/LGv [Del]

>>7

Unlambda is fascinating. Most weird languages I can look at and think, wow, it must be a pain to try and program in this, but usually I can at least imagine how you do it. With unlambda, I am totally lost. I guess I don't have enough background in functional languages, because I really don't even know where to begin with that one.

10 Name: MAD-Leser!r4YvKJpWUc 05/01/02(Sun)16:28 ID:64MS/ztB [Del]

>>2
i guess i'm holding out out of pure curiosity. as for objective c, thanks for pointing it out, neat stuff. sticks out like a sore thumb in a regular c program though :O.

11 Name: dmpk2k!hinhT6kz2E 05/01/02(Sun)22:32 ID:JIZviRLG [Del]

Probably a good idea. Every programmer should know at least one functional language.

12 Name: !#usr/bin/anon 05/01/03(Mon)02:28 ID:ySculFH8 [Del]

>>7 Shut yo mouth! Esolangery (the study of languages like Malbolge [sic] and Unlambda) is a great way to kill both time and brain cells. Though they aren't as polished as BrainF*ck or Befunge, they are so bafflingly warped that they deserve their own place in the world.

>>9 Unlambda is basically just an elaborate cypher for Scheme, only with the goddamn v c and d to confuse people. I just copy and paste stuff from the examples into a collage of operators. It's a fucking bitch, though, and not as interesting as Thue or Shelta

13 Name: dmpk2k!hinhT6kz2E 05/01/03(Mon)04:12 ID:BaEcXxZw [Del]

I suppose I should mention perl.

Perl itself is fairly straightforward but has all kinds of hidden behaviors to trip the newcomer. The first time I started developing something in perl I recall bashing my head against the wall for an hour at a time over several weeks.

Once I figured it all out I promptly forgot most of it and just started using a limited subset of the language instead.

Perl's great, but beware that first step.

14 Name: Albright!LC/IWhc3yc 05/01/03(Mon)05:24 ID:qOOtmgyK [Del]

>"if" after the expression seems strange at first when you're used to C, until you realize it's just English: "Do this, if that".

Mmh... English can go both ways, though; "If that, do this."

I guess it's just what I'm used to. I mean, the first lang I coded in was C=64 BASIC: IF Y=10 THEN Y=0.

Naming languages which are intentionally obfuscated is cheating. :P Let's stick to langs that people actually use... In the many langs that have it, the function of lambda functions often eludes me, or why I would want to use one.

15 Name: !WAHa.06x36 05/01/03(Mon)13:46 ID:Xw9gVXkp [Del]

>>14

But the ordering Perl uses usually flows better as natural language. The problem with it, though, is that it doesn't allow an else statement. But that's not what it's for - it's for the really simple conditional lines, like my example above.

16 Name: hk0!0khonVgaHI 05/01/03(Mon)20:42 ID:VkiDya1r [Del]

>>15

Or switch statements.

{ foobar; break;} if /abc/;
{ xyzzy; fall_through(); } if /xyz/;
{ pedobear; break; } if /dqn/;
default;

17 Name: !#usr/bin/anon 05/01/24(Mon)06:31 ID:I13vk6rS

any discussion about arcane programming languages should not go without the mention of Whitespace and SPL

the sheer genius of the second one (Shakespeare Programming Language) is of particular interest

http://shakespearelang.sourceforge.net/report/shakespeare/

18 Name: !WAHa.06x36 05/01/24(Mon)13:10 ID:MSsAAfBN

SPL is definitely brilliant, but Whitespace is just Brainfuck, isn't it?

19 Name: Albright!LC/IWhc3yc 05/01/25(Tue)00:07 ID:9guWkeNf

http://compsoc.dur.ac.uk/whitespace/

Whitespace is a programming language in which the program is written using only the space, tab and newline characters. All other characters are ignored. Here's Hello World in Whitespace:
http://compsoc.dur.ac.uk/whitespace/hworld.ws

20 Name: dmpk2k!hinhT6kz2E 05/01/25(Tue)02:11 ID:CJQh765D

I wonder what would happen if I submitted a printout of an assignment in Whitespace to my professor...

21 Name: !#usr/bin/anon 05/01/25(Tue)06:05 ID:Heaven

I see. Whitespace is invisible brainfuck.

22 Name: !WAHa.06x36 05/01/25(Tue)12:35 ID:zabbbPMK

Looking a bit closer, it looks more like False than Brainfuck, but still.

Lingua::Romana::Perligata is still crazier.

23 Name: coda 2005-08-14 23:49 ID:FXINROVD

>>16
there is no 'break' or 'default' keyword in perl
here is a cool thing:

&{ {foo=>sub{print "poop"; eat_poop()}, bar=>sub{print 1..100}, dick=>\&punch}->{$which} }

equivalent to

switch($which) {
case 'foo':

etc.

24 Name: Furi!EuK0M02kkg 2005-08-16 03:32 ID:Heaven

Intercal!!

As for a (potentially) realistically interesting language, anyone used Haskell? It was developed by some guys over in Scotland, I think. It's a pure functional language.

We were taught it in COMP1A by our brilliant but scatterbrained lecturer, and it annoyed the hell out of me. It's got some good points, and it eats recursion for breakfast, but functional programming takes getting used to, I guess.

Still, you can use it for CGI stuff, so it's amusing in that respect. I also understand that the compiler was written in Haskell and compiled with the Haskell compiler, so... compilation recursion!

25 Name: dmpk2k!hinhT6kz2E 2005-08-16 03:58 ID:0CFOoNBv

On the topic of functional languages, there's one thing that pisses me off no end in OCaml: record labels all have a single namespace.

It's the strangest design decision I've ever seen in a language. For added hilarity, it seems the majority of functional languages contain this stupidity too. Have I missed something?

OCaml also has all these dumb quirks by default, like allowing either or or ||, but while you can use && you can't use and, because and is used for something else.

Not exactly major flaws, but it's like death by a thousand cuts.

26 Name: !WAHa.06x36 2005-08-16 12:32 ID:ZZqz/9WI

Objective-C is driving me up the walls. On the one hand, it does many things that are very nice: Message passing through a dispatcher instead of method calls as functions makes it very flexible for GUI work (although I wouldn't want to use it for anything else, as it would just be a performance hit), and overall the language has a great deal of reflection. It also has a class library that contains a whole lot of useful functionality.

However, it gets none of this QUITE right. The message passing syntax is ugly as sin, and uses named parameters. You'd think this would let you give parameters in any order, but you can't. To add insult to injury, the method names can be as long as several sentences, making them utterly impossible to remember, and forcing you to keep the reference docs open at all times. There exist monsters like "–initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:"

The memory allocation is somewhere half-way between manual and garbage-collected, combining the drawbacks of both. And there are lots of weird quirks, like how you always have to use pointers to objects, and objects-by-value are forbidden entirely.

This thread has been closed. You cannot post in this thread any longer.