简体   繁体   English

编译器设计:存储函数签名的最佳方法?

[英]Compiler design: best way to store function signatures?

I am planning on storing all the function signatures which allows overloading. 我打算存储所有允许重载的函数签名。 Right now I have a nested HashMap that looks something like this: 现在,我有一个嵌套的HashMap,看起来像这样:

HashMap<String,HashMap<ArrayList<Type>,Object>>

Where the first key, String , contains the name of the function. 第一个键String包含函数的名称。 The second key, ArrayList<Type> , contains parameter data types. 第二个键ArrayList<Type>包含参数数据类型。 Now, I know using ArrayList as a key is a terrible practice, so I wonder if there is a better solution to store the function signatures? 现在,我知道使用ArrayList作为键是一种糟糕的做法,所以我想知道是否有更好的解决方案来存储函数签名?

The design is fine. 设计很好。 I ended up keeping this design. 我最终保留了这个设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM