Basically, had trouble remembering the syntax, but showed real understanding of the language and its ideas.
With the release of GPT-4o, I decided to give another whirl. I gave it a PDF of the Newspeak grammar, and a few paragraphs abut Newspeak semantics (really a lot less than I did last time). I also showed it an example of UI code - classes CounterUI and CounterApp. I asked it to explain what these do and it did. Them I asked it write TodoMVC. It produces syntactically valid Newspeak code. It doesn't know the exact APIs, but came pretty close. Arguably, it hallucinated improvements to the Hopscotch library. Style could be improved (it needs to be told more about factories).
Here is the code it wrote:
'Root'
class TodoMVCUI usingPlatform: p = (
|
private Subject = p hopscotch Subject.
private Presenter = p hopscotch Presenter.
private List = p collections List.
|
) (
public class TodoItem = (
| public title <String> ::= ''. public completed <Boolean> ::= false. |
) (
) : (
)
public class TodoList = (
| public items <List> ::= List new. |
) (
public addItem: title = (
items add: (TodoItem new title: title).
)
public removeItem: item = (
items remove: item.
)
public toggleItem: item = (
item completed: item completed not.
)
public clearCompleted = (
items removeAll: [:item | item completed].
)
public remainingCount ^ <Integer> = (
^items count: [:item | item completed not].
)
) : (
)
class TodoListPresenter onSubject: s <TodoListSubject> = Presenter onSubject: s(
) (
definition = (
^column: {
textInput: 'New Todo' onAccept: [:title | subject addItem: title].
list: {
subject items do: [:item |
row: {
checkbox: item completed action: [subject toggleItem: item].
label: item title.
button: 'Remove' action: [subject removeItem: item].
}
].
}.
button: 'Clear Completed' action: [subject clearCompleted].
label: 'Remaining: ', subject remainingCount printString.
}.
)
) : (
)
public class TodoListSubject onModel: m <TodoList> = Subject onModel: m(
) (
createPresenter ^ <TodoListPresenter> = (
^TodoListPresenter onSubject: self.
)
) : (
)
) : (
)
and
'Root'
class TodoMVCApp packageUsing: manifest = (
|
private TodoMVCUI = manifest TodoMVCUI.
|
) (
public main: platform args: args = (
| ui = TodoMVCUI usingPlatform: platform. |
platform hopscotch HopscotchWindow openSubject: (ui TodoListSubject onModel: ui TodoList new).
)
) : (
)
Looks like it's time to look at integration into the IDE.