HNHacker News
TopNewBestAskShowJobs

bhdz

9 karma · joined February 20, 2010

submissionscomments
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
For more:

    git clone https://github.com/bhdz/glaslang.git
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
In fact, the symbols that form the syntax, doesn't matter at

all: standard symbol set:

    ~  # access, forward (standard)
    object ~ property
    -> # access, backward ("homosexual" call if you will)
    method -> object
    ->> # access, backward high ("homosexual" call with higher precedence than ~ and ->... very gay...)
    some ~ linkage ~ method ->> object
    <- # backcall semantics, normal precedence, "tailored" calling
    "eenie", "meeenie", "minie", "moe" <- count toes:
    take: basket: "apples", "oranges", "bananas" <<- fill basket:
    # take(basket().fill_basket("apples",...), ...)
    # BE CAREFUL with that code above
    # basket doesn't get created with the fruits, just empty basket which 
    # is subsequently filled with goodies
All these operators can be a different set, but these glyphs are the best in my opinion

~ # PS: PLEASE do NOT get offended by my characterization

# of certain method calls as "homosexual"

#

# Don't! This is just for laughs at the language

# I am not against gay community in any way

# and "homosexual" calls are actually the most

# useful feature of this language

#

# Thank you.

bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Glas doesn't care about keywords actually, the only "keywords" are the syntactic elements like ~ -> ->> { [ {{ {> <}

so you write:

    if: something ~ happened: and: something else ~ happened:
        logic ~ did: something ~ happened # ?
and

    for: x in: range: 12, 32
        {{ x }}
this chains the needed things nicely in fact you can write like this:

    in: range: 5, 13
        perform: a task

    for: x in: iter: person
        {{ x }}
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Ah yes!

    {{ \t, "eject eject eject!" }}
    auto destruct: 20s -> space ship
    {> user ejected % wait: 20s, any -> input <}

    {{ "Your ship explodes in a gigantic fireball!" }}

    if: empty: -> input ->> user ejected
        {{ "You fail to eject, Ouch!" }}
        space ship ~ pilot ~ die: "massive splosion"
    space ship ~ destruct: "massive splosion"
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)

    a space adventure = space ship, blasters, rockets, lasers, *, **:  -> Space Ship:
        space ship ~ attach weapons: blasters, rockets, lasers:
            {{ "Eeeekkrrrrgh! Weapons attached successfully!" }}
            {{ "listing:" }}
            for weapon in *: #all arguments of attach weapons
                 {{ "Weapon:", weapon }}
        else:
            {{ "WARNING! WARNING! Ship weaponry attachment FAILED }}
            {{ "You're defenseless!" }}

        detach weapons: -> space ship:
            {{ "Weaponry detached, seek cover!" }}
        else:
            {{ "Weaponry detachment FAILED!" }}
            {{ \t, "AUTODESTRUCT SEQ. INITIATED" }}
            {{ \t, "EJECT EJECT EJECT!" }}
            auto destruct: 20s -> space ship
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Nevermind that, listen to this:

    nevermind: that --> listen: this ~ to
    # nevermind(that).listen(this.to)

    # All you do is complain and whine to your boss,
    #  slacking, sipping a lot of coffee at the coffeeshop:
    complain: and whine -> my ~ boss -> slack: sip coffee: a lot --> coffeeshop
    # my.boss.complain(and_whine).slack(
    #      coffeeshop.sip_coffee(a_lot)
    #    )
    
    foo: normal dict['some key'] -> bar
;)
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Now you can use the familiar

    do something: a dict ['some key'], coordinates['x']
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
New ROCKING syntax!

    #!/usr/bin/env glas
    #
    # Yay, and hear these spoken words of wisdom, Stranger:
    #
        and: he ~ walked: through the valley ~ 
                valley + shadows & 
                valley + shadows + death --> 
                    and: he ~ feared: not: evil
    #
    # versus the barbaric cries of the past!
    #
    #! old pythonic
    #
        and( 
            he.walked( through_the_valley.combine(
                [valley, shadows], [valley, shadows, death] )
        ).and( he.feared(not(evil)) )
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
If you find '.' and ''' and ''s' offending, you can change the symbol to the old dot and "@" for instance.

and that's much better than that.much better, don't you think?

    cookie adventure: my @ Cookie Monster = 
        print "Cookie Monster, why is the Cookie jar empty?"
        why: my.cookie.jar.empty: @ cookie monster 

        # why cookie monster, why? :)
        why: my.cookie.jar.empty: @ cookie monster .why: "tell me!"
bhdz··on A Python 3 implementation for client-side web programming
I have a better idea for a new language based on python:

    and walked: "through the valley"' he's and feared: not: "evil"!
    # he.and_walked("through the valley").and_feared(not("evil"))!

    drop down:' criminal scum!
    # criminal_scum.drop_down()!

    eat: breakfast' you!
    # you.eat(breakfast)!

    kill: with pistol' maim: blunt object' opponent's check dead:
    # opponent.maim(blunt_object).kill(with_pistol).check_dead()

    print person's name's last
    print person's last' name # ;)
    # print person.name.last

    if my's cookies's jar's empty::
        print "Cookie Monster, why is the Cookie jar empty?"
        why: cookie jar's empty:' cookie monster 

        # why cookie monster, why? :)
        why: cookie jar's empty:' cookie monster's why: "?"

it's called Glas :)
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Just like Python, Glas (Глас) doesn't really distinguish between dicts, objects or methods/functions. For it functions are just a fancier version of objects which are a fancier version of normal dicts. Later on, during evaluation, Glas makes a distinction, not before though.

I am planning on adding additional features like adding statements after each method call with the ':' operator, like this:

    # ship.attach_weapons(...):

    ship's attach weapons: blasters, rockets, lasers:
        print "Eeeekkrrrrgh! Weapons attached successfully!"
        print "listing:"
        for weapon in *: #all arguments of attach weapons
             print "Weapon:", weapon
    else:
        print "WARNING! WARNING! Ship weaponry attachment FAILED"
        print "You're defenseless!"

    detach weapons:' ship:
        print "Weaponry detached, seek cover!"
    else:
        print "Weaponry detachment FAILED!"
        print "  AUTODESTRUCT SEQ. INITIATED"
        print "  EJECT EJECT EJECT!"
        auto destruct: 20s' ship
bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
Ah! Yes! :)

I had some kind of a satori Saturday, so it's still just a glas.py file which aims are being a simple as possible translator into Python. (for now it just parses it and evals it like a barbarian, and still not workable ;))

I will make a repo later today, after work.

bhdz··on My newest invention: The Glas Language (A Pythonic offshot)
:D

It doesn't care basically if it's encountering a dict ({}), an object, or a function/method.

If it's not a function then it's either a dict OR another object instance. it it's a function it applies it! Glas treats everything as potential functions or procedures (no arguments) math sin: x could be _anything_ really :)

Use '$' sign if you wish to refer to function's object explicitly like this:

    a function name # could be application?
    $ a function name # definitely function object to be referred!
bhdz··on Conde Nast refuses to run Prop 19 ads on reddit
You're probably downvoted because of "fear mongering racists" & "economic agenda." Now you're left with the "scientific term" for marijuana which is fine but off-topic (which is Prop 19, Reddit & CN).

Ytiquette is not written anywhere here, but I suppose it follows Reddiquette guidelines to some extend.

PS: your link (http://www.jackherer.com/chapter04.html) looks like it comes from dubious, tinfoilhat-like source.

bhdz··on Blogger beware: Postings can lead to lawsuits
It would be an interesting experiment if a blogger adds a small disclaimer: "This is a work of fiction &| gossip" to his "libelous, slanderous" "claims"... Or put every adjective in "quotes" with "some say" at the beginning. This would confuse the lawsuits even further.
bhdz··on 10k TowerDefense (JS & Canvas)
Yours should be more like 'front defence.' Anyway, good job, I would definitely remove it from the 'experiments' section if I were you, this game is popular... I like how the turrets are missing from time to time.

PS: Why front(+al) defence? Well, expand the game field a bit more, and put the player into defending strategic locations, let the AI figure a way through... I can imagine giant fields & fortified positions, much like WWI :)

(Or you could christen the game 'Lobotomy')

bhdz··on I have tried to be happy with django, I really have.
Ok HN :-/

However, for those interested in model package loading automation, I started a section on reddit: http://www.reddit.com/r/django/comments/d1ulg/automatic_mode..., may be I'm wrong...

Sorry for bothering you...

bhdz··on I have tried to be happy with django, I really have.
Model package management: It's a dirty kludge. Not documented (last time I've checked), I had to search hard to get it right.

You must edit models/__init__.py such that:

    import X from Y 
...and then each model must have

    class Meta:
        app_label = 'foobar' 
Without the meta information Django cannot load the models inside the package, it imports only models.py.

May be it should be automated (model loader)? For instance, the model loader could parse the directory tree and import all necessary info it needs(meta information, optional), all is needed is a function for it :-/

edit: Format, gramer :)

edit2: Phah! OK. I'm gonna do it. Automatic model loader function, Django extension :) (May be next week...)

bhdz··on Learn Python The Hard Way: a new book by Zed Shaw
Would you include Haskell in?
← PreviousPage 2 of 2