For example, specifying that an ID from the TypeName() namespace can be used (@-syntax), without ever specifying somewhere where it may be defined (@=-syntax) causes the namespace to be excluded from analysis-auto.generated.str. E.g. by specifying:

TypeName@ID -> Type {"CustomType"}

This causes errors if, for example, one wants to add pre-defined types, but not provide the ability to create custom types.

adjust-index-lookup(target |namespace, path, prefix): 
	CustomType(<target>) ->  [
		Def([TypeName(), "MyType"]),
		Def([TypeName(), "AnotherType"]),
		
		[TypeName() | path]
	]
Submitted by D. Pelsmaeker on 31 May 2012 at 17:30

On 5 June 2012 at 10:32 Guido Wachsmuth commented:

Can you please explain why you need predefined types in a reference mechanism? I can imagine that you want predefined types in type checking. But why do you need to resolve to predefined types? What is the expected behaviour of resolving a reference which has no definition site?


On 5 June 2012 at 10:50 D. Pelsmaeker commented:

It is a common use case to have some special types (e.g. Int, Boolean) in addition to the types that are defined. These special types are never defined explicitly. By including those types manually in the namespace the code completion and type checking support these types without extra work. Now this example is the same case but without the ability to define custom types, so only the pre-defined types are available. It will be easy to add the ability to define custom types in the future.

Without the ability to define custom types, resolving to predefined types still ensures that there is only one definition (my special predefined definition) that such a type refers to. Then the later code generation phase can deal with those types.

By the way, this was just an example. In general, when for any reason someone specifies a namespace use (@), the namespace should be defined, allowing it to be manipulated. Another example would be resolving to a predefined variable that always exists, allowing it to be used like any other variable. Or a predefined set of functions without the ability to add your own.


On 8 January 2013 at 14:18 Eelco Visser tagged wontfix

On 8 January 2013 at 14:19 Eelco Visser commented:

This is related to the old SDF annotations for name bindings. Use NBL instead.


On 8 January 2013 at 14:19 Eelco Visser closed this issue.

Log in to post comments