Open curimit opened 11 years ago
Amazing feature.!
Amazing! plz pay attention to the left part for that sometimes it's easy to use these if you brought out this feature.
cout << "x=#{k + 1}"
It shall be compiled to
cout << ({
std::stringstream _t_sstream;
_t_sstream << "x=" << k + 1;
_t_sstream.str();
});
Seems it's easy for only dealing with "#{}"
, plz make sure there are some way to get exactly #{.*}
.
Please check it when finished, THX.
这一坨feature等我完成编译器自举以后再继续写……
I've used this all the time in LS, but there's this one thing that's always nagged me about it: The assymetry of the notation - I find it often is a bit cluttered and unclear. A notation I do find to be very clear in this regard is:
interpolation := "elephant"
text := "room"
"Here we have an {{interpolation}} in the {{text}}"
Ofcourse it doesn't follow the Ruby or LiveScript syntax, but still, it is much clearer imho.
Seems good, I'll check this.
Yeah, the where
clauses from Haskell is neat, would also be for making
localized functions etc. Generally.
In the case of the interpolations, I mean ofcourse it should interpolate
variables in the scope as usual, just with the change (or addition) of the
double braces notation..
2014-12-10 4:42 GMT+01:00 curimit notifications@github.com:
How about this?
text := "Here we have an {{interpolation}} in the {{text}}" where interpolation := "elephant" text := "room"
— Reply to this email directly or view it on GitHub https://github.com/curimit/SugarCpp/issues/25#issuecomment-66400441.
In ruby we can format string in this way:
So in SugarCpp, we can just write this
Which compiles into this