You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using std::pair<SourceLoc, T> or std::pair<T, SourceLoc> for fields makes reading usage sites harder as one needs to keep track of the types of the first and second field. It would be good to have a currency type:
Q: Where should Located<T> be defined?
A: I think it should be defined in a new header, Basic/Located.h. Basic because we expect it to be used throughout the compiler, similar to SourceLoc.
Q: What implicit conversions should Located<T> have?
A: We probably don't want an implicit conversion from T because that makes it easier for someone to create a Located<T> that conceptually doesn't make sense. Similarly we probably don't want a conversion from Located<T> to T as that makes it easy to accidentally drop a SourceLoc.
Q: Which operators should be overloaded?
A: Probably just the shift operator to make things convenient for print debugging. We can add more stuff later if the usage sites make it seem like more operator overloads would be useful.
The text was updated successfully, but these errors were encountered:
gomezd (JIRA User) are you working on this issue? mkita (JIRA User) has a PR up for this (as they marked themselves as the assignee) so you don't need to work on this. Feel free to pick another StarterBug which isn't already taken 🙂.
Additional Detail from JIRA
md5: d65bfa4b042fd60690d622e6c0308dd8
Issue Description:
Using
std::pair<SourceLoc, T>
orstd::pair<T, SourceLoc>
for fields makes reading usage sites harder as one needs to keep track of the types of the first and second field. It would be good to have a currency type:and use that consistently throughout the compiler. For example,
could be replaced with
Q: Where should
Located<T>
be defined?A: I think it should be defined in a new header,
Basic/Located.h
.Basic
because we expect it to be used throughout the compiler, similar toSourceLoc
.Q: What implicit conversions should
Located<T>
have?A: We probably don't want an implicit conversion from
T
because that makes it easier for someone to create aLocated<T>
that conceptually doesn't make sense. Similarly we probably don't want a conversion fromLocated<T>
toT
as that makes it easy to accidentally drop a SourceLoc.Q: Which operators should be overloaded?
A: Probably just the shift operator to make things convenient for print debugging. We can add more stuff later if the usage sites make it seem like more operator overloads would be useful.
The text was updated successfully, but these errors were encountered: