[ZILF] Inaccurate Error About 3 Or More Args for Routines?

I’m reporting an oddity in ZILF error reporting. But I’m not sure if I’m misunderstanding something.

Consider the following code:

<ROUTINE GO ()
  <INIT>
>

<ROUTINE INIT ()>

ZILF responds with: [error MDL0226] cloak.zil:5: ROUTINE requires 3 or more args

It’s referring here to the INIT routine.

But you don’t need any arguments at all. (Arguments being what appear in the parentheses.) What apparently you need are three or more expressions. But even that’s not true. You only need one. Consider:

<ROUTINE GO ()
  <INIT>
>

<ROUTINE INIT ()
  <CRLF>
>

That compiles just fine. As I go through writing tutorials for ZILF and ZIL, I’m finding lots of little oddities so I’m trying to see where my expectations are incorrect, particularly about terminology.

It’s a LISP-like language. In LISP dialects, the keyword to define a function (defun in Common Lisp, define in Scheme etc) is just another function which returns a value but also has the side-effect of defining a function.

So, “ROUTINE” is to be considered the name of a function. It takes 3+ arguments: The function name, the parameter list, and at least one function call.

2 Likes

Ah, got it! Thank you. So it was a misconception on my part of how the terminology was used based on the structure of the language.

Excellent. I’ll definitely include this in my tutorial notes. Granted, not many people will come across this problem perhaps but I learn everything by building up from the most minimal examples and that’s how I tend to write tutorials as well.

Thanks for the clarification and edification!

1 Like