[nem-pl] Re: [svn] nemerle/trunk/lib/internal-numbered.n
Kamil Skalski
nazgul at omega.pl
Thu Jun 3 16:00:50 CEST 2004
Thursday 03 June 2004 12:16, Lukasz Kaiser wrote:
> Hej.
>
> > hmm...
> >
> > postscan
> > macro MakeEquals (t : TypeBuilder) {
> > def flds = t.GetFields (NemerleAttributes.Public %|
> > NemerleAttributes.NonPublic %|
> > NemerleAttributes.Instance);
> > def body =
> > List.FoldLeft (flds, <[ true ]>, fun (x : IField, acc) {
> > def nm = UsesiteSymbol (x.Name);
> > <[ $acc && $(nm : name).Equals (parm.$(nm : name)) ]>
> > };
> > t.Define (<[ decl:
> > public Equals (parm : $(t.FullName () : dyn)) { $body }
> > }
> >
> > Jak przetestuj??, co commitn?? :D
>
> Hmm, a mogloby od razu dodwac GetHashCode ? Czy w ogole przeciazanie
> GetHashCode ma sens, a jesli tak to jak go dobrze przeciazyc dla
> krotek, czy XOR jest ok czy zupelnie bez sensu ?
gint32
ves_icall_System_String_GetHashCode (MonoString *me)
{
int i, h = 0;
gunichar2 *data = mono_string_chars (me);
MONO_ARCH_SAVE_REGS;
for (i = 0; i < mono_string_length (me); ++i)
h = (h << 5) - h + data [i];
return h;
}
w mono mają tak dla stringów, jakieś lepsze propozycje?
>
> - lk
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-pl
More information about the devel-pl
mailing list