Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ITT we code in our own fictional languages.

Name: Anonymous 2008-08-23 20:31


func say($s) { echo $s, "\n"; }
class :open Thing {
    var :pub=r :priv=rw $thing;
    func :pub :pure hai() {
        return func () { say "Hai."; }
    }
    func :priv die() { die(); }
}
class :open Thing {
    func hai() {}
}
class :open String {
    func :pub :uses=$var makeAwesome() {
        $var = "Awesome!"; # Or somesuch.
    }
    func __toInt() {
        return 5;
    }
}
Thing::hai()();
(new String("Hai!") == "Hai")
say "Lol"->makeAwesome(); # "Awesome!"
say "Num" + 5; # "10"

Name: Anonymous 2008-08-24 9:25

until = fun: (b, c) ->
    while({ not(b()) }):
        c()

Animal = class:
    __init__ = (name) ->
        self.name = name

    make_sound = ->
        print('Generic animal noise.')

Dog = class(Animal):
    make_sound = ->
        print('Woof.')

Cat = class(Animal):
    make_sound = ->
        print('Meow.')

SlashProgSlasher = class(Animal):
    make_sound = ->
        print('Read SICP')

haskell = Dog('Haskell')
haskell.make_sound()

read_sicp = False
days_until_sicp = 10

slash_prog_slasher = SlashProgSlasher('Anonymous')

until({ read_sicp }):
    slash_prog_slasher.make_sound()

    if days_until_sicp == 0:
        print 'SICP read!'
        break

    print('%i days until SICP.' % [days_until_sicp])
    days_until_sicp -= 1


It's FIOC without statements like >>7, but it's more like Scheme because you can pretty much do anything with it. Oh and


foo(...):
    bar


is short for foo(..., {bar}). Not too keen on how while/until look and I'm not sure how to make 'break' work, but I like it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List