[plt-scheme] A question about using the ellipsis as a temporary substitute for the program body (among other things).

From: John Clements (clements at brinckerhoff.org)
Date: Mon Mar 12 13:52:14 EDT 2007

On Mar 12, 2007, at 9:09 AM, Daniel Yoo wrote:

> On Mon, 12 Mar 2007, Lou Oswald Meneses wrote:
>> Hi! I am using Dr. Scheme set to Beginning Student and I'm  
>> wondering why using the three dots for the purpose I described in  
>> the title, as suggested in "How to Design Programs", doesn't work.
> Hi Lou,
> I think what you mean is that you're seeing the error message:
>    ...: name is not defined, not an argument, and not a primitive  
> name in:
>        ...
> "..." is just a placeholder, so any program that contains it won't  
> execute or "Check Syntax" properly until '...' is replaced with  
> whatever it really should contain.
> What you can do, temporarily, is define '...' to some scratch value  
> at the top of your program.  For example:
> ;;;;;;;;;;;;;;;;;;;;;;;;;
> (define ... "fill me in")
> ;; foo: number -> number
> ;;
> ;; Example of writing out a function template:
> (define (foo n)
>   (cond
>     [(zero? n) ...]
>     [else ...]))
> ;;;;;;;;;;;;;;;;;;;;;;;;;
> Here, we define "..." to stand for the string value "fill me in".

Frankly, I don't think this is a good idea.

That is, the point of "..." is that it's a space that must be filled  
in.  So it's not surprising that the code won't run until you fill in  
those dots.  That's appropriate, and providing a binding for could  
lead to bad code.

In particular, suppose I forget to write a test case for one branch,  
and forget to replace the ellipses with code; having a binding such  
as the one that you describe means that the code will run fine, and  
fail later.

Perhaps what you really want is instead to get an error message like  

"..." : can't run this code, because you haven't filled it in yet.   
If this is part of a template, remember that templates need to be  
commented out in running code.

Would that be better?

John Clements

p.s.: all of this message is predicated on the assumption that Danny  
is correct about the error you're seeing, and is correct in his  
inference about the problem you're experiencing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20070312/6252f110/attachment.p7s>

Posted on the users mailing list.