Object Orientated Thinking & Definition of a Function

I’ve been writing this language with the goal being that the result of all this effort will be a language that’s object-orientated. So, sticking to my guns, I’ve created  the functionality of a “Koi” which is an object definition. This concept is nothing new of course and commonly called “classes” in most modern languages.  If you’ve seen the grammar in the last post, you’ve seen it baked in.  The Koi is a definition of an object and is one-to-one relationship for a koifile (KoiFish source code file with the file extension of .koi).

With this said, it presented me with an interesting problem that, for whatever reason, I completely forgot about–linking! I’ve been pondering (pun severely intended–you’ll get it in a second) a solution to the design of how the linker should work to incorporate multiple Entities and therefore multiple koi files.  Languages like use header files to accomplish this task but to me seem extremely cumbersome, too verbose, and a serious violation of the DRY (don’t repeat yourself) policy. So my next progression will be implementing multiple koi support through a single file that holds references to each koi-file.  I’ve appropriately named this collection of koi-files as a pond file (.pond file extension).

That aside, I’ve had to update the definition a function which I found takes the role of both an expression and a statement like below:

# here is an expression
def x = call SomeFunction;

# here is a statement
call AnotherFunction;

The difference being that the function call is either a stand alone or to be evaluated and have its result be the actual expression. As far as whether the function itself is ever really an expression is still up for debate in my mind, however what’s clear is that it needs to, at least from a parsing standpoint, be treated as such to adhere to the grammar defined.

This entry was posted in KoiFish and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s