Version française
Home     About     Download     Resources     Contact us    
Browse thread
Compiler translation of array indexing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David McClain <dmcclain@a...>
Subject: Compiler translation of array indexing
I would like to suggest a slightly more expressive form for the translation
of array indexing operators x.(..) and x.[..]. In Dylan these get translated
into message sends to generic function "element" (or "aref" in the case of
multiple indices). Instead of translating as in OCAML to Array.get and
Array.set, they could be translated into some equivalent to

x.(n)  ->  module_of(type_of x).get(x, n)

This would allow us to develop modules containing refined versions of get,
set, unsafe_get, and unsafe_set to do whatever would be appropriate for the
object being indexed. Currently, I don't know of any operators named
"module_of" and "type_of" and these might in fact not make much sense given
the vast optimizations performed in the compiler -- there are not unique
tags for disparate data types since the language is type checked at compile
time.

Just some thoughts and wishes...

David McClain, Sr. Scientist
Raytheon Systems Co.
Tucson, AZ