[m-users.] Initialising a map with static data

Sean Charles (emacstheviking) objitsu at gmail.com
Tue Jan 25 10:11:40 AEDT 2022


Is there a more concise way of creating a map full of static data? The best I have obtained is this:

default_typemap = Out :-
    map.from_assoc_list([
        ("i"    - "int"),
        ("psz"  - "char*"),
        ("v"    - "void"),
        ("pv"   - "void*"),
        ("c"    - "char"),
        ("sc"   - "signed char"),
        ("uc"   - "unsigned char"),
        ("pc"   - "char*"),
        ("ppc"  - "char**"),
        ("cpc"  - "const char*"),
        ("cppc" - "const char**")
    ],
    Types),
    map.from_assoc_list([
        ("argc" - "int"),
        ("argv" - "ppc")
    ],
    Vars),
:
: .. more code..
:

Each backend coder that is a for typed language will be providing an initial lookup of both variables and types so it can infer necessary typing at code render time.

Thanks,
Sean

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220124/aad65cb1/attachment.html>


More information about the users mailing list