If you're having trouble using Context Free or don't understand the language, ask for help here.
Moderators: MtnViewJohn , chris , mtnviewmark
pakin
Posts: 43 Joined: Sat Apr 21, 2007 8:59 pm
Location: United States
Contact:
Post
by pakin » Fri Sep 07, 2012 10:38 pm
The
Number Parameter Restrictions wiki entry presents examples of legal and illegal usage of
number parameters. However, when I try compiling those examples, I get an error on one of the "Allowed" lines. Here's a demonstration of the problem:
Code: Select all
startshape begin
shape taper(number shrink) {
SQUARE []
taper(shrink) [size shrink] // Allowed, shrink is a number parameter
}
shape begin {
taper(0.9) [ ]
}
Alas,
Code: Select all
$ cfdg taper.cfdg
Error in taper.cfdg at line 5 - This expression does not satisfy the number parameter requirement
So who's right? The compiler or the documentation?
— Scott
MtnViewJohn
Site Admin
Posts: 882 Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:
Post
by MtnViewJohn » Sat Sep 08, 2012 3:30 pm
That code should work. The documentation is correct.
This will get you going for now:
Code: Select all
shape taper(number shrink) {
SQUARE []
taper(=) [size shrink] // Allowed, shrink is a number parameter
}
In general, you should use
= whenever you can with parameters. Otherwise you end up generating multiple identical parameter blocks on the heap.