Closed Calvin-L closed 6 years ago
Do you just want this changed on TBag
, TSet
, and TList
? There's also t
in TApp
, TRef
, and TVector
. Also TTuple
has a ts
and a n
in it as well.
Yes, those should probably also get cleaner names.
(Also, I am not sure TVector
is used anymore.)
I'll take a look at TVector
and do some cleaning up.
Similarly, are most of the .f
s .fields
as well? I was looking through it and it seems to make sense. Since they're in EArgMin
and so on...
No, most of the f
s are functions. So perhaps:
EArg{Min,Max}.f
--> .key_function
(reminiscent of key
in Python's min
, max
, and sorted
functions)ELet.f
--> .body_function
EMakeMap2.value
--> .value_function
When I change EArg(Min|Max).f
to .key_function
, EMap
and EFlatMap
breaks. For now I will temporarily change their .f
to .key_function
as well.
Followup: This is because in some places where you're checking isinstance(_, _)
there are groups of EArg(Min|Max) or EFlatMap or EMap
.
Yep, those isinstance
checks are hacky. They exploit the fact that all of those AST nodes have .e
and .f
properties. You should fix them by duplicating those checks and their bodies for each different case.
I agree that, too, feels wrong. We should think about a better design for the places that happens.
Everything should be covered in #47.
The classes that represent collection types (
TBag
,TSet
, andTList
) use the attributet
for the type of their elements. This is ugly and is a bad name.We should rename
t
toelem_type
. This will be a wide-reaching change and we should be careful we got it right. Python's untyped nature makes it tricky.Similarly, we might also want to perform these other renamings:
ETupleGet.n
-->.index
EGetField.f
-->.field_name
SDecl.id
-->.var
(and change its type fromstr
toEVar
)SForEach.id
-->.loop_var
T
andF
-->ETRUE
andEFALSE
(This is a follow-up to #43 and #44.)