gen~ : clang error no viable conversion

Vincent Goudard's icon

Hi,

while trying the (undocumented) rate object in gen, I got an error with a really simple patch (see below), and I just can't figure out what's wrong... Got the same error in Max6 and latest (7.0.1) version.

Console says :
clang: error line 2093 column 46: no viable conversion from 'Rate' to 'double'
gen~: failed to compile patcher

Max Patch
Copy patch and select New From Clipboard in Max.

Does anyone know what that means ? Are there float/double type that I am not aware of ?

Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Your Param name has the name of an object, which causes the problem. If you rename it, it works properly:

Vincent Goudard's icon

doh! :)
thanks Emmanuel

Does this behaviour somehow imply that it is possible to use an object name on gen~ to make some kind of scripting control ? or is it just plain namespace collision ?

Graham Wakefield's icon

Operator names are reserved words in the GenExpr language, which all gen patchers get translated into. In most cases a name clash is hidden from you, but in the case of your patcher a conflict has arisen because of the presence of a [rate] operator in the same space as [param rate]. This is a bug. It's theoretically possible to work around this, but it would add to the overhead of parsing/code generation; keeping that low has been a priority for the cases where gen patchers get large & complex (which is also where they show the greatest efficiency gains).

This is worth revisiting, given how easy it is to want to use the same name for a parameter as an operator! Logged as ticket #8794 and looking into it.

Graham Wakefield's icon

Update: a fix for this should be in the next update.