On Thu, Mar 06, 2014 at 12:02:42AM +, develop32 wrote:
> On Wednesday, 5 March 2014 at 23:47:33 UTC, H. S. Teoh wrote:
> >Whoa. What did you do with those arrays?? Either you did something
> >wrong, or there's a nasty bug somewhere in the compiler/language;
> >AFAIK static arrays are supposed t
On Wednesday, 5 March 2014 at 23:47:33 UTC, H. S. Teoh wrote:
Whoa. What did you do with those arrays?? Either you did
something
wrong, or there's a nasty bug somewhere in the
compiler/language; AFAIK
static arrays are supposed to be value types so they shouldn't
generate
any garbage at all.
On Wednesday, 5 March 2014 at 23:41:30 UTC, Frustrated wrote:
It would be cool if it was a compile time value though. That
way you could make sure code generating ctfe's were never
included in the binary.
Yeah... one way to kinda do that now is to write it all inside a
if(__ctfe) {} block.
On Wed, Mar 05, 2014 at 11:31:12PM +, develop32 wrote:
> On Wednesday, 5 March 2014 at 22:46:40 UTC, sclytrack wrote:
> >Are there any disadvantages of using a fixed size array for fixed
> >size coordinates and vectors, over creating an actual typedef or
> >struct Vec3?
>
> Don't know what's t
On 03/05/2014 03:10 PM, Frustrated wrote:
>> assert(s.Do(1, 2.5) == 3.5);
> And this is exactly what I don't what!
Sorry, I've completely misunderstood. :)
> Do, in my case, is a ctfe used
> only at compile time to make it easy to generate code. It's not needed
> at runtime and does not be
On Wednesday, 5 March 2014 at 23:36:34 UTC, Adam D. Ruppe wrote:
On Wednesday, 5 March 2014 at 23:17:45 UTC, Frustrated wrote:
is it a purely compile time construct?
I think it is the same as auto return functions. Both auto and
enum in this context are storage classes. In the compiler, it
l
On Wednesday, 5 March 2014 at 23:17:45 UTC, Frustrated wrote:
is it a purely compile time construct?
I think it is the same as auto return functions. Both auto and
enum in this context are storage classes. In the compiler, it
looks like enum in this context forwards to parse declaration,
jus
On Wednesday, 5 March 2014 at 23:33:25 UTC, Frustrated wrote:
Maybe the problem isn't what I thought it was. I created a test
case that works:
import std.stdio, std.cstream;
mixin template C()
{
alias A = typeof(this);
mixin(B!(A));
}
template B(T)
{
pragma(msg, T);
e
On Wednesday, 5 March 2014 at 23:20:08 UTC, bearophile wrote:
Frustrated:
how does an enum return type work?
enum foo(string s) { return s; }
As far as I know that's not valid D (but D is extremely
tolerating).
Bye,
bearophile
Well, it works... not sure exactly what it's doing though.
Maybe the problem isn't what I thought it was. I created a test
case that works:
import std.stdio, std.cstream;
mixin template C()
{
alias A = typeof(this);
mixin(B!(A));
}
template B(T)
{
pragma(msg, T);
enum B() { return "string foo() { return `<"~T.stringof~">`; }";
On Wednesday, 5 March 2014 at 22:46:40 UTC, sclytrack wrote:
Are there any disadvantages of using a fixed size array for
fixed size
coordinates and vectors, over creating an actual typedef or
struct Vec3?
Don't know what's the current situation in druntime, but when I
tried static arrays a wh
Frustrated:
how does an enum return type work?
enum foo(string s) { return s; }
As far as I know that's not valid D (but D is extremely
tolerating).
Bye,
bearophile
how does an enum return type work?
enum foo(string s) { return s; }
is it a purely compile time construct?
That is, we can guarantee that foo, as a function, won't exist at
runtime? e.g., it is a true ctfe instead of a function that can
be executed at compile time or runtime?
On Wednesday, 5 March 2014 at 23:04:06 UTC, Ali Çehreli wrote:
On 03/05/2014 02:37 PM, Frustrated wrote:
>> import std.typetuple;
>>
>> template fooImpl(T...)
>> {
>> static assert(is (T[0] == S));// <-- COOL!
>> static assert(is (T[1] == int));
>> static assert(is (T[2] == doubl
On 03/05/2014 03:04 PM, Ali Çehreli wrote:
template Do(T...)
{
mixin DoImpl!(TypeTuple!(typeof(this), T));
Actually, TypeTuple is not needed there:
mixin DoImpl!(typeof(this), T);
Ali
On 03/05/2014 02:37 PM, Frustrated wrote:
>> import std.typetuple;
>>
>> template fooImpl(T...)
>> {
>> static assert(is (T[0] == S));// <-- COOL!
>> static assert(is (T[1] == int));
>> static assert(is (T[2] == double));
>> }
>>
>> template foo(T...)
>> {
>> alias foo = fooIm
On Sunday, 2 March 2014 at 18:59:23 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 15:23:03 UTC, H. S. Teoh wrote:
This is a pretty good primer to templates:
https://semitwist.com/articles/article/view/template-primer-in-d
The trouble is with most of these tutorials that they off
On Wednesday, 5 March 2014 at 19:21:39 UTC, Adam D. Ruppe wrote:
On Wednesday, 5 March 2014 at 19:15:12 UTC, Namespace wrote:
Is there a way to extract the correct typeinfo of an array if
I only have the pointer?
Nope, typeinfos are only stored in runtime on classes. All
other types get it on
On 03/05/2014 01:30 PM, Frustrated wrote:
I am trying to remove the unnecessary passing of the type of class to a
template but can't seem to get it to work:
see
The code is the
mixin(AbstractToInterface!(WindowsGui, iButton, WindowsButton,
iBorder, WindowsBorder));
which I want to not
On Wednesday, 5 March 2014 at 22:35:46 UTC, Ali Çehreli wrote:
On 03/05/2014 01:30 PM, Frustrated wrote:
I am trying to remove the unnecessary passing of the type of
class to a
template but can't seem to get it to work:
see
The code is the
mixin(AbstractToInterface!(WindowsGui, iButto
I am trying to remove the unnecessary passing of the type of
class to a template but can't seem to get it to work:
see
The code is the
mixin(AbstractToInterface!(WindowsGui, iButton, WindowsButton,
iBorder, WindowsBorder));
which I want to not have to specify WindowsGui.
I've t
On Wednesday, 5 March 2014 at 19:15:12 UTC, Namespace wrote:
Is there a way to extract the correct typeinfo of an array if I
only have the pointer?
Nope, typeinfos are only stored in runtime on classes. All other
types get it only through the static info.
Consider the following:
char[10] a;
Is there a way to extract the correct typeinfo of an array if I
only have the pointer?
Code:
import std.stdio;
struct Foo {
int i;
}
void foo(void* p) {
// ???
}
void main() {
Foo[] fs;
fs ~= Foo();
foo(fs.ptr);
}
Now that we have only the untyped void*: Is
On 03/05/2014 09:49 AM, Jeremy DeHaan wrote:
> On Monday, 3 March 2014 at 07:38:05 UTC, Ali Çehreli wrote:
>> The documentation says that Mutex is a recursive lock, meaning that
>> the holder of the lock can lock it even further. :) There is an
>> internal reference count so that the lock must be
On Monday, 3 March 2014 at 07:38:05 UTC, Ali Çehreli wrote:
The documentation says that Mutex is a recursive lock, meaning
that the holder of the lock can lock it even further. :) There
is an internal reference count so that the lock must be
unlocked the equal number of times that it has been l
On Wednesday, 5 March 2014 at 02:28:00 UTC, Nick Sabalausky wrote:
On 3/3/2014 5:35 PM, Chris wrote:
Maybe I'm a bit too philosophical about this. But consider the
following
(made up) case:
struct MyTemp(T) {
// ...
T add(T a, T b) {
if (a is string && b is string) {
26 matches
Mail list logo