Skip to content

Comment on My newest invention: The Glas Language (A Pythonic offshot)

Comments

Afaik my's last' name is equivalent to

my.name['last']

How does the ' operator decide between need for 's and not?

Where is the GitHub page? :-) What did you learn :-) Who are you ?

Nice one

bhdzOP

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
bhdzOP

: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!
bhdzOP

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
;)
bhdzOP

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.