[M3devel] typenames vs. lexical scope vs. backend?

Tony Hosking hosking at cs.purdue.edu
Sat Oct 23 20:04:12 CEST 2010


You could mangle the name to prefix the scope.

On 23 Oct 2010, at 06:06, Jay K wrote:

> 
> Um.. the same name can be different types, in different scopes.
> 
> 
> <*NOWARN*>PROCEDURE F1() =
> TYPE T1 = INTEGER;
> BEGIN
> END F1;
> 
> <*NOWARN*>PROCEDURE F2() =
> TYPE T1 = LONGINT;
> BEGIN
> END F2;
> 
> =>
> 
> (16) declare_procedure name:Main__F1 n_params:0 return_type:void lev:0 exported:false
> (17) declare_typename my_id:0x195C2A74 name:T1
> 
> (18) declare_procedure name:Main__F2 n_params:0 return_type:void lev:0 exported:false
> (19) declare_typename my_id:0x5562176 name:T1
> (20) comment comment:F1
> (21) set_source_line 6
> 
> (22) begin_procedure procedure:Main__F1
> (23)     set_source_line 7
> (24)     set_source_line 9
> (25)     exit_proc type:void
> (26) end_procedure procedure:Main__F1
> 
> (27) comment comment:F2
> (28) set_source_line 0xB(11)
> (29) begin_procedure procedure:Main__F2
> (30)     set_source_line 0xC(12)
> (31)     set_source_line 0xE(14)
> (32)     exit_proc type:void
> (33) end_procedure procedure:Main__F2
> 
> 
> Is the backend to record the types within some scope, and then observe
> the scopes coming back?
> 
> 
> Or, then again, are typenames worth much to the backend?
> Well, maybe.
> They aren't needed for display the values of variables,
> but they might be nice in expressions that include casts?
> 
> I'm thinking maybe the right thing is to ignore them in the backend.
> ??
> 
>  - Jay
> 		 	   		  




More information about the M3devel mailing list