labath added a comment.

In D69230#1720246 <https://reviews.llvm.org/D69230#1720246>, @dblaikie wrote:

> In D69230#1720048 <https://reviews.llvm.org/D69230#1720048>, @labath wrote:
>
> > That said, I think you have convinced me that having different optional 
> > representations for a single type is not a good idea. It's probably better 
> > to use some form of a "strong" typedef to achieve that instead.
>
>
> I've not followed this part of the thread properly - could you/someone 
> rephrase the concerns here?


Sure. lldb currently has types like lldb::pid_t, and uses identifiers like 
LLDB_INVALID_PID for the "None" value. I wanted to define pid_t as something 
like `Optional<some_integer_type, PIDInfo>`, where PIDInfo would specify what 
is the representation of an "invalid" pid. The reason I abandoned this idea was 
that this arrangement makes it impossible to represent (in the type system) a 
pid which is always valid. I now think that it would be better (at least for 
this use case) to have `pid_t be a "strong" typedef of the integer type. At 
that point you can specify an "invalid" value for this type even without a 
separate Optional template argument...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69230/new/

https://reviews.llvm.org/D69230



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to