Cpp tagged strings #679
-
|
In the book section helpful idiom we present the following (cpp/raw "size_t get_string_size(std::string const &s)
{ return s.size(); }")My suggestion is limiting embbeded c++ code this to a tagged string with
How it would look like: (cpp/raw #cpp "size_t get_string_size(std::string const &s)
{ return s.size(); }")
(cpp/raw #cpp "struct person
{ std::string name; };")The main benefit I see is reducing |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi! Thanks for the proposal. Others are welcome to join in, but I will share my thoughts. jank currently supports (let [s #cpp "meow"] ; s is a char const [5]
(println s))We also support this for other primitive literals, such as So, given that knowledge, using However, secondly, I think that Altogether, I think this would require more typing for the users, be a frequent mistake for them to forget the |
Beta Was this translation helpful? Give feedback.
Hi! Thanks for the proposal. Others are welcome to join in, but I will share my thoughts.
jank currently supports
#cppstrings, such as#cpp "meow". However, this doesn't mean "A string containing C++ code". It means "A C++ literal string." For example:We also support this for other primitive literals, such as
#cpp 5,#cpp true,#cpp 3.14, etc. This allows jank users to work directly with C++ primitive types, rather than boxed jank objects.So, given that knowledge, using
#cppfor C++ strings would be inconsistent with the approach.However, secondly, I think that
#cppwithincpp/rawis also redundant. As we have seen in #24 (wh…