On Friday, 19 June 2015 at 19:10:11 UTC, Shachar Shemesh wrote:
On 14/06/15 04:31, Adam D. Ruppe wrote:
On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote:
I have read that in D structs are always allocated on the
stack while
classes are always allocated on the heap.
That's not true; it
On 14/06/15 04:31, Adam D. Ruppe wrote:
On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote:
I have read that in D structs are always allocated on the stack while
classes are always allocated on the heap.
That's not true; it is a really common misconception.
Putting a struct on the heap
On Wed, 17 Jun 2015 06:02:46 +, WhatMeWorry wrote:
I guess the question would be why would one want a struct on the heap
and a class on the stack? Performance reasons?
struct on the heap: some containers, for example, doing their own memory
management.
class on the stack: guaranteed
On Sunday, 14 June 2015 at 01:31:25 UTC, Adam D. Ruppe wrote:
On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote:
I have read that in D structs are always allocated on the
stack while classes are always allocated on the heap.
That's not true; it is a really common misconception.
Putting
I have read that in D structs are always allocated on the stack
while classes are always allocated on the heap. Well, I often
have classes where I want some instances on the stack, some on
the heap. So.. what to do?
On Sunday, 14 June 2015 at 01:31:25 UTC, Adam D. Ruppe wrote:
On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote:
I have read that in D structs are always allocated on the
stack while classes are always allocated on the heap.
That's not true; it is a really common misconception.
Putting
On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote:
I have read that in D structs are always allocated on the stack
while classes are always allocated on the heap.
That's not true; it is a really common misconception.
Putting a struct on the heap is trivial and built into the
language:
On Thursday, 19 February 2015 at 08:24:08 UTC, Jonathan Marler
wrote:
I am having a heck of a time trying to figure out how to do
this.
How do I change the attributes of a function based on the
version without copying the function body? For example:
version(StaticVersion) {
static void
I am having a heck of a time trying to figure out how to do this.
How do I change the attributes of a function based on the
version without copying the function body? For example:
version(StaticVersion) {
static void myLongFunction()
{
// long body ...
}
} else {
void
On Thursday, 19 February 2015 at 09:38:48 UTC, Mike Parker wrote:
On Thursday, 19 February 2015 at 08:24:08 UTC, Jonathan Marler
wrote:
I am having a heck of a time trying to figure out how to do
this.
How do I change the attributes of a function based on the
version without copying the
On Thursday, 19 February 2015 at 08:24:08 UTC, Jonathan Marler
wrote:
I am having a heck of a time trying to figure out how to do
this.
How do I change the attributes of a function based on the
version without copying the function body? For example:
version(StaticVersion) {
static void
Most practical approach I am currently aware of is wrapping
actual implementation (in most restrictive version):
class Test {
private static void foo_() {}
version (Static)
{
static void foo() { foo_(); }
}
else
{
void foo() { foo_(); }
}
private void bar_() shared
{
}
version
On Thursday, 19 February 2015 at 10:17:47 UTC, Dicebot wrote:
Most practical approach I am currently aware of is wrapping
actual implementation (in most restrictive version):
I really like mixins for this sort of thing.
```
enum signature = void longFunction();
version( Static )
enum
On Thursday, 19 February 2015 at 17:23:47 UTC, Mike Parker wrote:
I agree that string mixins can kill readability. I encountered
that when I used them to support both D1 and D2 in Derelict 2
years ago. But I think that when they are kept small and local
as in cases like this, they aren't bad
On Thursday, 19 February 2015 at 12:16:18 UTC, Mike Parker wrote:
On Thursday, 19 February 2015 at 10:17:47 UTC, Dicebot wrote:
Most practical approach I am currently aware of is wrapping
actual implementation (in most restrictive version):
I really like mixins for this sort of thing.
```
On Thu, 19 Feb 2015 08:24:06 +, Jonathan Marler wrote:
I am having a heck of a time trying to figure out how to do this.
How do I change the attributes of a function based on the
version without copying the function body? For example:
version(StaticVersion) {
static void
On 2/20/2015 1:06 AM, tcak wrote:
@OP: By using a token string (q{}) for funcBody rather than a WYSIWYG
string (r or ``), you can still get syntax highlighting in your editor.
Based on your example, bye bye readibility. It is like writing rocket
taking off procedures.
People are complaining
On 05/23/2014 09:09 AM, bioinfornatics wrote:
struct A {
@section( ( word ) = word[0] == '@', ( word ) =
word[0] == '\n')
int a;
}
I was able to make that work if I used function instead of delegate:
import std.stdio;
struct attribute { }
alias MatchFunc = bool
On Monday, 26 May 2014 at 19:50:29 UTC, Ali Çehreli wrote:
On 05/23/2014 09:09 AM, bioinfornatics wrote:
struct A {
@section( ( word ) = word[0] == '@', ( word ) =
word[0] == '\n')
int a;
}
I was able to make that work if I used function instead of
delegate:
import
I bask originally this qustion in this thread :
http://forum.dlang.org/post/rsnswykpjfzenpliv...@forum.dlang.org
but another thread is better as that is not exactly same topic.
I would like to use custom annotate/attribute on members as:
struct A
{
@Parser(
start = (
20 matches
Mail list logo