On Monday, 23 September 2013 at 07:47:32 UTC, Jacob Carlborg
wrote:
On 2013-09-20 16:12, simendsjo wrote:
You could of course fix this in a library too.
enum AttributeUsage {
struct_ = 1 0,
class_ = 1 1,
//etc
}
struct attribute { AttributeUsage usage; }
Then the library could give
On Monday, 16 September 2013 at 07:36:13 UTC, simendsjo wrote:
I don't have a full example without adding a lot of code, but
this partial
example might give you the gist of it.
// This is the type that validates
struct matches(string mustMatch)
{
alias re = ctRegex!(mustMatch);
On 2013-09-20 08:59, ilya-stromberg wrote:
Can I explicitly specify when I can use attribute? Something like
this:
@attribute(field)
struct matches(string mustMatch)
{
}
string wrongAttribute
{
}
class Foo
{
@matches([0-9]+)
string someNumber; //OK, it's a field
}
@matches([0-9]+)
On Friday, 20 September 2013 at 07:57:43 UTC, Jacob Carlborg
wrote:
On 2013-09-20 08:59, ilya-stromberg wrote:
Can I explicitly specify when I can use attribute? Something
like
this:
@attribute(field)
struct matches(string mustMatch)
{
}
string wrongAttribute
{
}
class Foo
{
On 2013-09-16 22:15, Namespace wrote:
Then of course I have not said anything.
The same thing I would suggest for scope. It exists as a library
solution and is rewritten magical.
I think the big difference here is that AA's are safe where scope is
not. I agree with you, I like to use scope
On 2013-09-17 00:53, H. S. Teoh wrote:
Hmm. I find D arrays just fine the way they are, actually. (In fact, I
rather *liked* the way D arrays worked as compared with, say, C/C++.)
What's wrong with them?
I guess one can complain about some of the built-in
properties/functions, like sort.
On 09/17/13 00:53, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 10:59:10PM +0200, Artur Skawina wrote:
On 09/16/13 22:38, Namespace wrote:
[1] Obviously, not a practical short term option for the existing
D2 language. That's probably clear from the context, and the
question was meant to
On Sunday, 15 September 2013 at 18:31:40 UTC, simendsjo wrote:
On Sunday, 15 September 2013 at 17:34:06 UTC, matovitch wrote:
Hi everyone,
I read the documentation about user defined attributes, but I
don't see their uses. Ok, it'a a template expression you can
link to a declaration, but
On Monday, 16 September 2013 at 06:47:40 UTC, ilya-stromberg
wrote:
On Sunday, 15 September 2013 at 18:31:40 UTC, simendsjo wrote:
On Sunday, 15 September 2013 at 17:34:06 UTC, matovitch wrote:
Hi everyone,
I read the documentation about user defined attributes, but I
don't see their uses.
All your examples are great, thank you ! Is there a way to omit
validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void fun(@nonNull C c) {
...
};
C c;
fun(c); //compilation error since C is null
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to omit
validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void fun(@nonNull C c) {
...
};
C c;
fun(c); //compilation error since
On Monday, 16 September 2013 at 10:36:16 UTC, Bienlein wrote:
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to
omit validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to omit
validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void fun(@nonNull C c) {
...
};
C c;
fun(c); //compilation error since
On Monday, 16 September 2013 at 15:12:05 UTC, Maxim Fomin wrote:
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to
omit validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void
On Monday, 16 September 2013 at 15:47:36 UTC, ilya-stromberg
wrote:
On Monday, 16 September 2013 at 15:12:05 UTC, Maxim Fomin wrote:
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to
omit validate such that the compiler
On Monday, 16 September 2013 at 16:50:43 UTC, Namespace wrote:
On Monday, 16 September 2013 at 15:47:36 UTC, ilya-stromberg
wrote:
On Monday, 16 September 2013 at 15:12:05 UTC, Maxim Fomin
wrote:
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank
On Monday, 16 September 2013 at 17:50:16 UTC, Maxim Fomin wrote:
Ideally structs should have default constructors (hello to
those who miss them - problem #2) which could initialize class
instance.
Do you know why D structs don't have default constructors? I
really miss.
On Monday, 16 September 2013 at 17:50:16 UTC, Maxim Fomin wrote:
On Monday, 16 September 2013 at 16:50:43 UTC, Namespace wrote:
On Monday, 16 September 2013 at 15:47:36 UTC, ilya-stromberg
wrote:
On Monday, 16 September 2013 at 15:12:05 UTC, Maxim Fomin
wrote:
On Monday, 16 September 2013 at
On Monday, 16 September 2013 at 18:44:25 UTC, ilya-stromberg
wrote:
On Monday, 16 September 2013 at 17:50:16 UTC, Maxim Fomin wrote:
Ideally structs should have default constructors (hello to
those who miss them - problem #2) which could initialize class
instance.
Do you know why D structs
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to omit
validate such that the compiler would call it implicitly ?
For example :
class C {
...
}
void fun(@nonNull C c) {
...
};
C c;
fun(c); //compilation error since
On Mon, Sep 16, 2013 at 08:56:17PM +0200, Namespace wrote:
[...]
I hate this NotNull struct hack. It is the same crap as the current
scope solution. BTW: I'm curious which built-in feature will be
removed next, maybe AA?
[...]
That wouldn't be a bad idea, actually. The current AA
Long time not heard from each other. ;)
On Monday, 16 September 2013 at 19:28:22 UTC, Andrei Alexandrescu
wrote:
On 9/16/13 11:56 AM, Namespace wrote:
I hate this NotNull struct hack. It is the same crap as the
current
scope solution.
Scoped variables in the language were a lot worse.
On 9/16/13 11:56 AM, Namespace wrote:
I hate this NotNull struct hack. It is the same crap as the current
scope solution.
Scoped variables in the language were a lot worse.
BTW: I'm curious which built-in feature will be removed
next, maybe AA?
If we're diligent and lucky, hopefully.
An
On Monday, 16 September 2013 at 19:28:22 UTC, Andrei Alexandrescu
wrote:
On 9/16/13 11:56 AM, Namespace wrote:
And I agree absolute, to disable default CTor's by struct's
was a huge
mistake. But D is full of those. ;)
They are not disabled. It seems many people are having trouble
with
On Mon, Sep 16, 2013 at 12:28:21PM -0700, Andrei Alexandrescu wrote:
On 9/16/13 11:56 AM, Namespace wrote:
I hate this NotNull struct hack. It is the same crap as the current
scope solution.
Scoped variables in the language were a lot worse.
One thing I'd *really* like to have is proper
On Monday, 16 September 2013 at 19:21:47 UTC, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 08:56:17PM +0200, Namespace wrote:
[...]
I hate this NotNull struct hack. It is the same crap as the
current
scope solution. BTW: I'm curious which built-in feature will be
removed next, maybe AA?
[...]
On Monday, 16 September 2013 at 19:58:51 UTC, Namespace wrote:
Why should anyone switch to D if it is nothing else as a new
C++?
It's worth pointing out that the library AAs proposed here would
still have the same syntax as the built-in ones now.
int[string] a;
would just be magically
On Monday, 16 September 2013 at 20:15:26 UTC, Namespace wrote:
On Monday, 16 September 2013 at 20:09:53 UTC, Adam D. Ruppe
wrote:
On Monday, 16 September 2013 at 19:58:51 UTC, Namespace wrote:
Why should anyone switch to D if it is nothing else as a new
C++?
It's worth pointing out that the
On Monday, 16 September 2013 at 20:09:53 UTC, Adam D. Ruppe wrote:
On Monday, 16 September 2013 at 19:58:51 UTC, Namespace wrote:
Why should anyone switch to D if it is nothing else as a new
C++?
It's worth pointing out that the library AAs proposed here
would still have the same syntax as
On Monday, 16 September 2013 at 20:16:45 UTC, Namespace wrote:
And maybe also for delete: we need something to delete the
memory manually.
And we need built-in memory allocators, not only GC.
On 09/16/13 22:38, Namespace wrote:
[1] Obviously, not a practical short term option for the existing D2
language.
That's probably clear from the context, and the question was meant to be
rhetorical -- but it could actually be done and would make sense; it's
just
not a change
On Monday, 16 September 2013 at 21:11:00 UTC, Artur Skawina wrote:
On 09/16/13 22:52, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 10:38:58PM +0200, Namespace wrote:
D is not only about arrays.
It's a big plus. ;)
[1] Obviously, not a practical short term option for the
existing D2
language.
D is not only about arrays.
It's a big plus. ;)
[1] Obviously, not a practical short term option for the
existing D2 language.
That's probably clear from the context, and the question
was meant to be
rhetorical -- but it could actually be done and would make
sense; it's just
not
On 09/16/13 22:52, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 10:38:58PM +0200, Namespace wrote:
D is not only about arrays.
It's a big plus. ;)
[1] Obviously, not a practical short term option for the existing D2
language. That's probably clear from the context, and the question
was meant
On 09/16/13 21:58, Namespace wrote:
On Monday, 16 September 2013 at 19:21:47 UTC, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 08:56:17PM +0200, Namespace wrote:
[...]
I hate this NotNull struct hack. It is the same crap as the current
scope solution. BTW: I'm curious which built-in feature will
On Mon, Sep 16, 2013 at 10:38:58PM +0200, Namespace wrote:
D is not only about arrays.
It's a big plus. ;)
[1] Obviously, not a practical short term option for the existing D2
language. That's probably clear from the context, and the question
was meant to be rhetorical -- but it could
On Mon, Sep 16, 2013 at 10:59:10PM +0200, Artur Skawina wrote:
On 09/16/13 22:38, Namespace wrote:
[1] Obviously, not a practical short term option for the existing
D2 language. That's probably clear from the context, and the
question was meant to be rhetorical -- but it could
On Monday, 16 September 2013 at 19:21:47 UTC, H. S. Teoh wrote:
On Mon, Sep 16, 2013 at 08:56:17PM +0200, Namespace wrote:
[...]
I hate this NotNull struct hack. It is the same crap as the
current
scope solution. BTW: I'm curious which built-in feature will be
removed next, maybe AA?
[...]
Hi everyone,
I read the documentation about user defined attributes, but I
don't see their uses. Ok, it'a a template expression you can link
to a declaration, but what are they useful for ? (not sure about
the syntax ;-))
Can you declare a template constraint as a user defined attribute
to
On 2013-09-15 19:34, matovitch wrote:
Hi everyone,
I read the documentation about user defined attributes, but I don't see
their uses.
I'm using it in my serialization library:
struct Foo
{
int a;
@nonSerialized int b;
}
Indicates b will not be serialized.
struct Bar
{
int a;
On Sunday, 15 September 2013 at 17:34:06 UTC, matovitch wrote:
Hi everyone,
I read the documentation about user defined attributes, but I
don't see their uses. Ok, it'a a template expression you can
link to a declaration, but what are they useful for ? (not sure
about the syntax ;-))
Can
41 matches
Mail list logo