I have writer’s block.
I decided on prototypal inheritance for Yap a few weeks ago, as I want to keep the interpreter as simple as possible and classical inheritance adds lots of plumbing. Anyway, to pull it off, I don’t NEED any new keywords, as I could just offer some intrinsic functions that set up and test for inheritance (such as inherits() and instanceof()). However, I want the code to flow a little better than that, and I want to choose keywords that can be combined togther and not sound completely ridiculous.
On top of all of this, I’d like to make a keyword whose sole job is to provide a block for instantiating functions, much like how a class block would act in another language. Any functions defined in that block would be added to the object referenced in the block’s creation.
Every time my brain has gone idle in the last few weeks, it slowly works its way back to playing madlibs with two or three possible constructs that I want to be valid. I figured I’d share this game of madlibs in case someone out there has a brilliant combination of keywords that just “feels right”. Here we go:
# __B__ : a keyword which causes its LHS to be inherited from its RHS
# (and if LHS is null, make it a fresh object)
# __C__ : a keyword which returns boolean true if LHS inherits from RHS
# (must be different from __B__!)
# The __C__ keyword isn't going to be listed in the madlibs below, but it
# must fit thematically with them, and would look something like:
# if Car __C__ Vehicle ...
# Pretend that I've implemented an object named Vehicle, and I would like
# to override a few functions in an inherited object named Car. Here are the
# madlibs that must ALL "not feel terrible":
# Note: the __A__ block will be allowed multiple times for a single object,
# so don't choose something that sounds too "final".
Car __B__ Vehicle
var Car __B__ Vehicle
__A__ Car __B__ Vehicle
__A__ var Car __B__ Vehicle
# Brainstorming possibilities:
Hopefully you can see through the crazy in this post and understood what I need help with!