icerpc / slicec

The Slice compiler library
Apache License 2.0
13 stars 5 forks source link

Split the `NamedSymbol` and `ScopedSymbol` Traits. #585

Closed InsertCreativityHere closed 1 year ago

InsertCreativityHere commented 1 year ago

Currently, we have this trait heirarchy: NamedSymbol <- ScopedSymbol <- Symbol But there's really no reason for NamedSymbol to require ScopedSymbol, so this PR decouples them.

Now there's Symbol and 2 more specific kinds of symbols: NamedSymbol (those with names) & ScopedSymbol (those in a scope), and these two have no relation to each other.


This change is motivated by the new module restriction. With the new semantics, modules shouldn't implement ScopedSymbol anymore, but they should implement NamedSymbol. They have a a name, but they aren't logically within a scope anymore. Modules are the scopes now.

In the past, modules could totally be within a scope: module Outer { module Inner {}} (Inner is within the scope of Outer).