calvinmm / lolcode-dsl

2 stars 1 forks source link

Required Line Numbers (or some variables) #4

Closed irvinshen closed 10 years ago

irvinshen commented 10 years ago

Just playing around with the Baysick code, it seems as if the implicit def classes require a line number (or some other Any)

implicit def int2LineBuilder(i: Int) = LineBuilder(i)

requires: [Int] Class args

The regular def classes don't, but the only way that they pass parameters is with parentheses.

def RUN() = gotoLine(lines.keys.toList.sorted.head)
def ASSIGN(a: Symbol) = [...]

requires: ASSIGN(x)

irvinshen commented 10 years ago

The latest push involves two possibilities moving forward (if you think of another, please say so!)

First which involves the use of parentheses:

        HAI
        VISIBLE("hello world")

        KTHXBAI

Second which doesn't have parentheses (but is arguably worse since it requires a prefix object Lol:

        Lol VISIBLE "hello world 2"

The second example will also require currying to pass multiple arguments

calvinmm commented 10 years ago

I think using parenthesis is fine, I don't mind them.

CorbynS commented 10 years ago

I've noticed a difference in execution between the two, with the parentheses behaving as expected. The Lol VISIBLE seems to print to console as soon as it is parsed, while the VISIBLE does not execute until all instructions have been parsed.

I am not sure which one we want.

irvinshen commented 10 years ago

The Baysick code I was referencing did the latter, so when I was copying, that's what I did. It's a simple code change from one to the other, I think.

It may be wiser to go through and parse the instructions first though (a la mySimpl) so that we can make sure to keep functions correctly (which Baysick doesn't have).

edit: Actually, I'm not sure if LOLCODE has functions.

calvinmm commented 10 years ago

Functions are defined in one of the links you posted.

According to this source, the syntax is:

HOW DUZ I <function name> [YR <argument1> [AN YR <argument2> …]]
  <code block>
IF U SAY SO

Seems a little funky, but we can worry about functions later on :+1:

calvinmm commented 10 years ago

We have decided to use parenthesis