Following code:

entity Dish {
name :: String
tags -> Set
}

define page createMenu() {
form {
var d: Dish
var dishes: List := select d from Dish;
"dish: " select(dish from dishes)
}
}

Compiles and runs OK but at runtime causes following error:

exception occured: No data type for node: org.hibernate.hql.ast.tree.IdentNode
-[IDENT] IdentNode: ā€˜dā€™

Submitted on 3 March 2010 at 21:55

On 3 March 2010 at 22:06 Scott Finnie commented:

response from Danny:

This uses a query to create the dishes List. Because d is not initialized the query is trying to select null which
causes the error. Initialization of variables is currently not checked in the compiler.

OK, that makes sense. Would be good if compiler checked and gave warning. From a usability perspective, would perhaps be even better if the code works as it stands. Reading the code as a layman, it looks like the variable is declared and its type known. It should therefore be possible to assign to it without further explicit initialisation.

Log in to post comments