#1679 Map.make...(Type k,Type v) is missing

jessevdam Tue 25 Oct 2011

I miss a function to create a Map dynamically from a key type and value type.

brian Tue 25 Oct 2011

Promoted to ticket #1679 and assigned to brian

brian Mon 14 Nov 2011

Ticket cancelled

This functionality actually already exists - I should have checked first. You just need to create a parameterized type:

type := Map#.parameterize(["K":Str#, "V":Slot#])
map := Map(type)

jessevdam Wed 16 Nov 2011

That is true, problem is that the parameterize is not implemented in JS

DanielFath Sat 26 Nov 2011

To chime in I think Map(Type K, Type V) would also serve as a nice shortcut for people who find Key:Val[:] hard and Map(Map#.parameterize(["K":Str#, "V":Slot#])) too verbose. I kinda expected it to already exist based on List[Type of, int capacity].

brian Sun 27 Nov 2011

To chime in I think Map(Type K, Type V) would also serve as a nice shortcut for people who find Key:Val[:] hard

Note they are two very different things: K:V is parameterization at compile time, what we are discussing here is parameterization at runtime.

DanielFath Sun 27 Nov 2011

I know the difference, however to a novice

Map(Map#.parametrize["K":Str , "V":Int]) 

is harder to understand than

Map(Str#, Int#)

.

Login or Signup to reply.