On Friday, 23 February 2018 at 00:54:34 UTC, Timothee Cour wrote:
in example below, how do I propagate RET (or even `typeof(a)`) to the
result value of `inferType`?

does this need a language change to allow this?

template inference(alias emitter) {
  auto inference(){
    auto inferType(){
enum RET=typeof(a).stringof; // type is known here, how to propagate?
        pragma(msg, RET);  // string
        }) ();
      return "unknown";
    // how to get RET? (or even typeof(a) )
    enum temp=inferType;
    pragma(msg, temp);

void main(){
  static void fun(alias put)(){

use case: allow type inference in `emit`

(see forum discussion here:

Yes there is a language change required for this.
Currently types are untouchable entities.
I plan to introduce a mechanism which'll give you first-class types inside a bounded semantic construct.

Reply via email to