[m-rev.] diff: avoid erlang atom length limit

Peter Ross pro at missioncriticalit.com
Fri Jun 1 15:58:06 AEST 2007


Hi,


===================================================================


Estimated hours taken: 0.25
Branches: main

compiler/elds_to_erlang.m:
	Erlang atoms have a maximum length, so make the atoms
	representing type_infos and pseudo_type_infos shorter.


Index: compiler/elds_to_erlang.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/elds_to_erlang.m,v
retrieving revision 1.9
diff -u -r1.9 elds_to_erlang.m
--- compiler/elds_to_erlang.m	1 Jun 2007 05:40:30 -0000	1.9
+++ compiler/elds_to_erlang.m	1 Jun 2007 05:56:17 -0000
@@ -531,18 +531,24 @@
 
             % TypeInfos are always local to the current module.
         InstanceModule = CurModuleName,
-        Atom = "ti_" ++ type_info_to_string(TypeInfo)
+        Atom0 = "ti_" ++ type_info_to_string(TypeInfo)
+            
+            % Erlang atoms have a maximum length, so shorten names
+        Atom = string.replace_all(Atom0, "type_ctor_info", "tci")
     ;
         RttiId = elds_rtti_pseudo_type_info_id(PseudoTypeInfo),
         ( PseudoTypeInfo = type_var(_) ->
             Prefix = "type_var_"
         ;
-            Prefix = ""
+            Prefix = "pti_"
         ),
             
             % PseudoTypeInfos are always local to the current module.
         InstanceModule = CurModuleName,
-        Atom = "pti_" ++ Prefix ++ pseudo_type_info_to_string(PseudoTypeInfo)
+        Atom0 = Prefix ++ pseudo_type_info_to_string(PseudoTypeInfo),
+
+            % Erlang atoms have a maximum length, so shorten names
+        Atom = string.replace_all(Atom0, "type_ctor_info", "tci")
     ;
         RttiId = elds_rtti_base_typeclass_id(TCName, InstanceModule,
             InstanceStr),

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list