[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Cating doubles to enums
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] Cating doubles to enums |
Date: |
Sun, 4 Nov 2018 21:36:29 +0100 |
On Sun, 4 Nov 2018 17:49:17 +0000 Greg Chicares <address@hidden> wrote:
GC> Therefore, what do you think of, say,
GC> double query (database_key);
GC> void query_ref(T&, database_key);
GC> void query_ref(vector<T>&, database_key);
GC> which distinguishes the names without denying the similarity of
GC> the operations?
I'm fine with this.
GC> I tried different second lexemes:
GC> query_value meaningless--they all retrieve values
GC> query_into seems obscure
But my preferred version would be this one.
GC> query_assign dunno--maybe
GC> query_imbue perhaps
GC> but couldn't find one that's clearly better than 'query_ref'
GC> (although query_imbue is starting to grow on me).
Sorry but I really don't like this one because "imbue" has, to the best of
my knowledge, only one well-known use in C++-related context and this is to
"imbue a stream with locale" and it's confusingly dissimilar to the meaning
assigned to it here. Besides, it just seems wrong to say we "imbue whatever
with its value from the database" as we do much more than imbue it, we copy
the value into it, overwriting its previous value.
GC> Or maybe the last two are distinct enough operations to deserve
GC> different names, because a T& and a vector<T>& are so different that
GC> calling them both '_ref' isn't optimally clear...so:
GC> double query (database_key);
GC> void query_imbue(T&, database_key);
GC> void query_fill (vector<T>&, database_key);
FWIW I think it's perfectly fine to overload the last 2 functions because
they do exactly the same thing. What will happen if we ever need to fill a
set<T>? I certainly hope we wouldn't use a third verb here...
OTOH using "query_fill" for both would be fine too, although personally I
still prefer "query_into", which is not perfect in isolation, but here, in
this context, seems very suitable because as it's both clearly parallel to
the version returning double and it equally clearly shows that it puts the
value(s) it reads into its output parameter.
GC> > GC> Sound good?
GC> >
GC> > Yes, absolutely. Do you prefer to do it yourself
GC> Yes, I hope to get it finished today.
TIA!
VZ
- [lmi] Cating doubles to enums, Vadim Zeitlin, 2018/11/02
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/02
- Re: [lmi] Cating doubles to enums, Vadim Zeitlin, 2018/11/02
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/04
- Re: [lmi] Cating doubles to enums,
Vadim Zeitlin <=
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/05
- Re: [lmi] Cating doubles to enums, Vadim Zeitlin, 2018/11/05
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/05
- Re: [lmi] Cating doubles to enums, Vadim Zeitlin, 2018/11/05
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/06
- Re: [lmi] Cating doubles to enums, Greg Chicares, 2018/11/06