Symbol collisions. #2
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	
	No description provided.
		
		Delete branch "%!s()"
	 
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When compiling programs, it is possible for numeric literals to clash with symbolic ones. This can result in very odd bugs where a symbol like
foogets confused for the number13and vice-versa.To avoid this, I propose that we expand numeric literals into pairs.
10would expand into# 10,12345would expand into# 12345, etc. This would allow us to disambiguate between numeric literals and actual symbols.In rules, to match a number, we can add the
#variablesyntax. That expands into# $variable, allowing you to explicitly match numbers.This feature should be an optional processing pass, as nothing stops you from manually annotating your values. It is simply a convenient syntax.
This will break some existing code that handles numeric literals alongside symbols, but I have a feeling it'd be a worthy change. We can't rely on strings forever.
Example usage is shown below.
Expanding this syntax yields the following.