[m-rev.] Re: diff: fix string_builder_test in erlang
Peter Wang
novalazy at gmail.com
Tue Sep 18 17:59:20 AEST 2007
On 2007-09-18, Peter Wang <novalazy at gmail.com> wrote:
> Estimated hours taken: 0.5
> Branches: main
>
> library/erlang_rtti_implementation.m:
> Don't return empty strings as the argument names of the functor [|].
> Just return the empty list to be consistent with the C backends.
>
> Similarly for tuples.
That was wrong.
Estimated hours taken: 0.5
Branches: main
library/construct.m:
Make the Erlang implementation of the `null' predicate succeed on
empty strings. We use empty strings for unnamed functor arguments.
library/erlang_rtti_implementation.m:
Revert a previous change. Return empty strings for the argument names
of [|] and tuple functors.
Index: library/construct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.39
diff -u -r1.39 construct.m
--- library/construct.m 30 Aug 2007 14:03:48 -0000 1.39
+++ library/construct.m 18 Sep 2007 07:53:58 -0000
@@ -359,11 +359,13 @@
").
:- pragma foreign_proc("Erlang",
- null(_S::in),
+ null(S::in),
[will_not_call_mercury, thread_safe, promise_pure],
"
- % There are no null pointers in erlang
- SUCCESS_INDICATOR = false
+ % Erlang doesn't have null pointers, but in erlang_rtti_implementation we
+ % return empty strings (binaries) for the cases where functor arguments
+ % have no names.
+ SUCCESS_INDICATOR = (S =:= <<>>)
").
get_functor_ordinal(TypeDesc, FunctorNumber) = Ordinal :-
Index: library/erlang_rtti_implementation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/erlang_rtti_implementation.m,v
retrieving revision 1.24
diff -u -r1.24 erlang_rtti_implementation.m
--- library/erlang_rtti_implementation.m 18 Sep 2007 07:25:01 -0000 1.24
+++ library/erlang_rtti_implementation.m 18 Sep 2007 07:53:59 -0000
@@ -1259,7 +1259,7 @@
type_ctor_info_and_args(TypeInfo, _TypeCtorInfo, ArgTypes),
Name = "{}",
Arity = list.length(ArgTypes),
- ArgNames = [],
+ ArgNames = list.duplicate(Arity, ""),
Result = yes({Name, Arity, ArgTypes, ArgNames})
;
TypeCtorRep = etcr_list,
@@ -1276,7 +1276,7 @@
Name = "[|]",
Arity = 2,
ArgTypes = [ArgTypeInfo, TypeInfo],
- ArgNames = [],
+ ArgNames = ["", ""],
Result = yes({Name, Arity, ArgTypes, ArgNames})
;
Result = no
--------------------------------------------------------------------------
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