Topic: constexpr functions without constexpr specifier: Use case.


Author: =?UTF-8?Q?Germ=C3=A1n_Diago?= <germandiago@gmail.com>
Date: Mon, 20 Oct 2014 02:45:52 -0700 (PDT)
Raw View
------=_Part_3051_522226065.1413798352160
Content-Type: text/plain; charset=UTF-8

Hello everyone,

I found a use-case where it would be useful to have constexpr functions
that are not marked as constexpr and
my question, at the moment, is if it would be technically feasible to have
something like that.

My use case is in the context of games, but it could be in other places.

Problem:

During game development it is very important to have fast iteration, so
scripting languages are often used.
At the end, when the game is delivered, I would like to have everything,
even code scripts, embedded into the
executable.

I could embed the scripts and compile at runtime, keeping the strings in
the code files.

But you could go a step further: compiling scripts at compile-time through
metaprogramming.
If I want to do this, I have to replicate an already written API, usually
in C.

For example, it would be nice in Lua or Squirrel, to be able to use these
functions as constexpr to embed the bytecode directly.
Otherwise, if you want to achieve this effect, you have to basically
reimplement everything only because the original API
won't work at compile-time.

Is there any chance that something like this is technically feasible?

Regards

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_3051_522226065.1413798352160
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello everyone,<div><br></div><div>I found a use-case wher=
e it would be useful to have constexpr functions that are not marked as con=
stexpr and</div><div>my question, at the moment, is if it would be technica=
lly feasible to have something like that.</div><div><br></div><div>My use c=
ase is in the context of games, but it could be in other places.</div><div>=
<br></div><div>Problem:</div><div><br></div><div>During game development it=
 is very important to have fast iteration, so scripting languages are often=
 used.</div><div>At the end, when the game is delivered, I would like to ha=
ve everything, even code scripts, embedded into the</div><div>executable.</=
div><div><br></div><div>I could embed the scripts and compile at runtime, k=
eeping the strings in the code files.</div><div><br></div><div>But you coul=
d go a step further: compiling scripts at compile-time through metaprogramm=
ing.</div><div>If I want to do this, I have to replicate an already written=
 API, usually in C.</div><div><br></div><div>For example, it would be nice =
in Lua or Squirrel, to be able to use these functions as constexpr to embed=
 the bytecode directly.&nbsp;</div><div>Otherwise, if you want to achieve t=
his effect, you have to basically reimplement everything only because the o=
riginal API</div><div>won't work at compile-time.</div><div><br></div><div>=
Is there any chance that something like this is technically feasible?</div>=
<div><br></div><div>Regards</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_3051_522226065.1413798352160--

.