input for globals should not be allowed

example app:

application exampleapp

entity Bla {
text::Text
}

var b1 := Bla{}

define page root() {
output(b1)
form{
input(b1)
submit action{} {“save”}
}
}

causes compiler error:

 [java] [ Main | info ] stage 9: code generation
    [java] Main: rewriting failed, trace:
    [java] 	webdslc_main_0_0
    [java] 	xtc_io_wrap_5_0
    [java] 	option_wrap_5_0
    [java] 	xtc_io_1_0
    [java] 	xtc_temp_files_1_0
    [java] 	restore_always_2_0
    [java] 	xtc_webdslc_0_0
    [java] 	stage_1_1
    [java] 	dr_scope_1_1
    [java] 	log_timed_1_1
    [java] 	core_to_java_servlet_0_0
    [java] 	log_time_1_1
    [java] 	generate_code_java_servlet_0_0
    [java] 	generate_code_java_servlet_0_0_fragment_0
    [java] 	generate_code_java_servlet_0_0
    [java] 	generate_code_java_servlet_0_0_fragment_0
    [java] 	generate_code_java_servlet_0_0
    [java] 	generate_code_java_servlet_0_0_fragment_0
    [java] 	generate_code_java_servlet_0_0
    [java] 	generate_code_java_servlet_0_0_fragment_0
    [java] 	generate_code_java_servlet_0_0
    [java] 	generate_code_java_servlet_0_0_fragment_0
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	scope_local_emit_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	dr_scope_1_1
    [java] 	log_time_1_1
    [java] 	GenerateCodeJavaServlet_0_0
    [java] 	actions_inputs_java_servlet_template_0_0
    [java] 	map_handle_actions_input_to_java_servlet_0_0
    [java] 	collect_om_1_0
    [java] 	collect_om_2_0
    [java] 	foldr_3_0
    [java] 	collect_om_2_0
    [java] 	foldr_3_0
    [java] 	collect_om_2_0
    [java] 	foldr_3_0
    [java] 	collect_om_2_0
    [java] 	foldr_3_0
    [java] 	collect_om_2_0
    [java] 	handle_actions_input_to_java_servlet_0_0
    [java] 	handle_actions_input_to_java_servlet_0_0_fragment_7
    [java] 	handle_actions_input_to_java_servlet_0_0_fragment_6
    [java] 	input_assignment_to_java_servlet_0_1
    [java] [ Main | critical ] Internal error: with clause failed unexpectedly in rule 'handle-actions-input-to-java-servlet'
    [java]            Select("root_bla0"{OriginalNameAnno("root_bla0"{"root_bla0"{"root_bla0"}}),"root_bla0"},SimpleSort("Bla"){EntityAnno("id",None,False),DefValueAnno(Null)},"Select",GlobalVar("b1"){TypeAnno(SimpleSort("Bla"){EntityAnno("id",None,False),DefValueAnno(Null)})},[],[]){InputNumber("input0")}
Submitted by Danny Groenewegen on 28 March 2010 at 10:30

On 28 March 2010 at 10:31 Eelco Visser commented:

input for globals should not be allowed: why not?


On 28 March 2010 at 10:52 Danny Groenewegen commented:

Besides this compilation error it is also not supported in the back-end, only the globals’ properties are allowed to be changed. Either change that or add a constraint, the point is that users should not see these stratego stack traces.


On 28 March 2010 at 10:57 Eelco Visser commented:

‘not supported in the back-end’ is not a justification in itself. I guess the argument here is that while the properties of globals may be changed, the objects themselves (their identity) is a constant, and can thus not be a assigned to. Convey this, it is perhaps better to declare these as

constant b := Bla{}

and then indeed verify in the typeckecker that there is no data binding (input and assignment) to these constants.


On 28 March 2010 at 11:17 Danny Groenewegen commented:

constant doesn’t seem the right term for an object that allows changes to its properties. Perhaps we should just call it global and let the constraints take care of the restrictions.

Note that there is already a constraint on assignment to globals.


On 28 March 2010 at 11:38 Eelco Visser commented:
global b := Bla{}

seems fine

Log in to post comments