On 17/03/2019 18:34, Kagamin via Digitalmars-d-learn wrote:
On Saturday, 16 March 2019 at 14:57:35 UTC, Paul Backus wrote:
This code fails to compile if you change `auto s2` to `const s2`--in other
words, it has the same problem as the original example.
Maybe there's not much need for qualifie
On 16/03/2019 11:19, Dennis via Digitalmars-d-learn wrote:
On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote:
Does anyone know if when I create a variable inside a scope as in
{int a = 10;}
it disappears complete from the memory when the scope finishes? Or does it
remain in some part of
PS: the chapter of Ali Çehreli's book on func args is great:
http://ddili.org/ders/d.en/function_parameters.html
diniz
On 16/03/2019 04:49, Paul Backus via Digitalmars-d-learn wrote:
On Friday, 15 March 2019 at 23:57:15 UTC, aliak wrote:
Anyone knows how to make this work?
You need an explicit `inout` on the return value of `make`:
auto ref make(T)(inout auto ref T value) {
return inout(S!T)(value);
}
On 15/03/2019 00:45, ag0aep6g via Digitalmars-d-learn wrote:
On 14.03.19 20:43, Jacob Carlborg wrote:
class C {
uint i ;
this (uint i) {
this.i = i ;
}
this (uint i) shared {
this.i = i ;
}
this (uint i) immutable {
this.i = i ;
}
}
On 14/03/2019 15:52, H. S. Teoh via Digitalmars-d-learn wrote:
On Thu, Mar 14, 2019 at 03:22:52PM +0100, spir via Digitalmars-d-learn wrote:
https://dlang.org/spec/hash-map.html#static_initialization:
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz&
On 14/03/2019 12:16, H. S. Teoh via Digitalmars-d-learn wrote:
On Thu, Mar 14, 2019 at 12:05:22PM +0100, spir via Digitalmars-d-learn wrote:
I desperately try to declare/define/initialise a simple class instance
at module-level. This is a special (conceptually static and immutable)
instance
https://dlang.org/spec/hash-map.html#static_initialization:
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
==> Error: non-constant expression `["foo":5L, "bar":10L, "baz":2000L]`
Also: I don't understand the error message:
* What is non-constant in the *expression*?
* A
I desperately try to declare/define/initialise a simple class instance at
module-level. This is a special (conceptually static and immutable) instance
used as a "marker", that just should exist and be accessible by methods of this
class and/or other classes defined in the same module. (Thus I do
On 12/03/2019 10:31, Boqsc via Digitalmars-d-learn wrote:
Please attach quick working examples for every sentence you write or it's just a
waste of time. People want to see the results and direct actions first before
anything else, it's more efficient communication. We are in the subforum of
Dl
On 09/03/2019 19:11, Jacob Shtokolov via Digitalmars-d-learn wrote:
The thing is that in PHP, for example, I would do
The thing is php needs to be able to "lexify" raw input data at runtime, while
in D this is done at compile-time. The ompiler has the lexer to do that.
But I agree that, for
On 09/03/2019 21:10, ANtlord via Digitalmars-d-learn wrote:
On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote:
You can end up with a null `this` reference if you dereference a null pointer
to a struct and then call a method on the result. For example:
I can but my reference is n
from [https://dlang.org/spec/attribute.html#abstract] :
---
abstract Attribute
An abstract member function must be overridden by a derived class. Only virtual
member functions may be declared abstract; non-virtual member functions and
free-standing functions cannot be declared abstract
Hello,
First, I am not very experimented with the combination of static lang (alloc &
typing) and OO (class-based). I'm implementing a library for lexical analysis
(lexing), with 2 minor issues:
-1- How to enforce that subclasses implement given methods without using
"abstract", which seems
On 17/10/14 09:29, thedeemon via Digitalmars-d-learn wrote:
On Friday, 17 October 2014 at 06:29:24 UTC, Lucas Burson wrote:
// This is where things breaks
{
ubyte[] buff = new ubyte[16];
buff[0..ATA_STR.length] = cast(ubyte[])(ATA_STR);
// read the string back from the
On 17/10/14 03:05, ketmar via Digitalmars-d-learn wrote:
On Fri, 17 Oct 2014 00:52:14 +
MachineCode via Digitalmars-d-learn
wrote:
I don't understand. If at least it were C but java? why not D
itself?
C is *awful* as "beginner's language". never ever let people start with
C if you don't h
On 17/10/14 07:38, maarten van damme via Digitalmars-d-learn wrote:
While d can be complex, there's nothing preventing you from starting out
simple and not using all features at first.
I don't understand why it's not suitable for a beginner if you use this
approach...
For some reasons, in my vi
On 16/10/14 20:46, Uranuz via Digitalmars-d-learn wrote:
I have some string *str* of unicode characters. The question is how to check if
I have valid unicode code point starting at code unit *index*?
[...]
You cannot do that without decoding. Cheking whether utf-x is valid and decoding
are the
Hello,
For what it's worth, I have finally found one use case for the famous "alias
this" trick for structs:
struct ScienceConstant {
float value;
string name;
alias value this;
string toString () { return this.name; }
}
unittest {
auto PI = ScienceConstant(3.14, "pi");
On 04/16/2011 06:55 AM, Andrej Mitrovic wrote:
I wonder.. in all these years.. have they ever thought about using a
convention in C where the length is embedded as a 32/64bit value at
the pointed location of a pointer, followed by the array contents?
Sometimes called "Pascal strings" (actually,
On 04/14/2011 08:33 PM, Steven Schveighoffer wrote:
If it does optimise, then it is definitely a compiler bug. Since you
*explicitely* ask for a double reverse, it *must* just do it. Suppressing
them is here just breaking the language's semantics!
I feel like people aren't looking at my post :)
On 04/14/2011 06:57 PM, Andrej Mitrovic wrote:
This leads me to another question I've always wanted to ask. A call such as:
auto b=map!foo(map!bar1(map!bar2(a));
This constructs a lazy range. What I'm wondering is if there are any
performance issues when constructing long chains of ranges like
On 04/14/2011 01:00 AM, Andrej Mitrovic wrote:
I'm trying to understand the design of ranges. Why does popFront only set the
front() property to return the next element in the range? Why not return the
element in the call to popFront right away?
For example code like this (which doesn't work s
On 04/13/2011 06:48 PM, bearophile wrote:
Bernard Helyer:
You could wrap the loop in an if clause:
if (condition) while (true) {
// ...
} else {
// ...
}
This is the semantics of the else clause of Python for (and while) loops:
bool broken = false;
for (...)
On 04/12/2011 11:51 PM, Steven Schveighoffer wrote:
On Tue, 12 Apr 2011 17:21:57 -0400, spir wrote:
On 04/12/2011 09:21 PM, Steven Schveighoffer wrote:
int main(){
int a,b;
do{
scanf("%d %d",&a,&b);
}while(ahttp://www.digitalmars.com/d/2.0/statement.html#DoStatement)
On 04/12/2011 09:21 PM, Steven Schveighoffer wrote:
int main(){
int a,b;
do{
scanf("%d %d",&a,&b);
}while(ahttp://www.digitalmars.com/d/2.0/statement.html#DoStatement)
[...]
I think the grammar should be changed...
yop!
This is almost as bad as go's
requirement for if sta
/usr/bin/ld: Warning: size of symbol
`_D5table14__T5TableTkTkZ5Table7opApplyMFDFKkZiZi' changed from 96 in
/tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o to 100 in
/tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o
???
Note: this is just a warning, program runs
On 04/12/2011 02:20 PM, Ishan Thilina wrote:
I can compile the following code. But when I run the program it gives me a
"core.exception.RangeError@untitled(34): Range violation
" error.
The code is as follows.
"
import std.stdio;
int main(char[][] args)
{
struct Node{
On 04/11/2011 09:18 PM, bearophile wrote:
spir:
Contracts, like any software tool, do not correctly match all possibly needs.
This is true in general, but this isn't true in this case: here they don't
match a basic need because D DbC misses a significant feature (prestate). If
On 04/11/2011 04:36 PM, Magnus Lie Hetland wrote:
I guess I could just use a local variable (guarded by version()) and then have
an assert() near the end of the function. Probably a better solution...
If you mean coding your checking "by habd" inside the func's "normal" body,
this seems to me
On 04/11/2011 10:10 AM, SimonM wrote:
On 2011/04/11 09:31 AM, spir wrote:
On 04/11/2011 02:42 AM, bearophile wrote:
I and Don have asked (in Bugzilla and elsewhere) to change the
built-in names into sbyte and ubyte, to avoid the common confusions
between signed and unsigned bytes in D, but
On 04/11/2011 06:45 AM, bearophile wrote:
- For me, and for Don and from other people that have had bugs in D caused by this, it
seems they think of "bytes" as unsigned things.
True for me as well. I was very surprised to discover 'byte' is /not/ unsigned
(this was actually the cause of my fi
On 04/11/2011 02:42 AM, bearophile wrote:
I and Don have asked (in Bugzilla and elsewhere) to change the built-in names
into sbyte and ubyte, to avoid the common confusions between signed and
unsigned bytes in D, but Walter was deaf to this.
I think a good naming scheme would be:
* signed
On 04/11/2011 01:47 AM, Andrej Mitrovic wrote:
alias Tuple!(byte, "red", byte, "green", byte, "blue") RGBTuple;
RGBTuple GetRGB(COLORREF cref)
{
RGBTuple rgb;
rgb.red = GetRValue(cref);
rgb.green = GetGValue(cref);
rgb.blue = GetBValue(cref);
return rgb;
}
[O your
On 04/10/2011 04:10 PM, spir wrote:
Hello,
I need a trick to allow a function template parameter be optional.
The following (reduced case) fails because D wants to call f:
uint f(uint i) { return i; }
struct S (alias func=null) {
enum bool hasFunc = !(func == null); // *** error line
On 04/10/2011 04:10 PM, spir wrote:
Hello,
I need a trick to allow a function template parameter be optional.
The following (reduced case) fails because D wants to call f:
uint f(uint i) { return i; }
struct S (alias func=null) {
enum bool hasFunc = !(func == null); // *** error line
Hello,
I need a trick to allow a function template parameter be optional.
The following (reduced case) fails because D wants to call f:
uint f(uint i) { return i; }
struct S (alias func=null) {
enum bool hasFunc = !(func == null);// *** error line ***
}
unittest {
// ok
auto s1 =
On 04/09/2011 07:08 PM, spir wrote:
Hello,
To insert of delete an array slice, I tried to use C's memmove, thinking it
would be far faster than "manually" copying bit per bit (by any kind of magic).
But I still wrote a D versions just to check what the actual speed gain is. To
my
Hello,
To insert of delete an array slice, I tried to use C's memmove, thinking it
would be far faster than "manually" copying bit per bit (by any kind of magic).
But I still wrote a D versions just to check what the actual speed gain is. To
my great surprise, the C-memmove and D-manual versio
On 04/08/2011 03:00 PM, Aleksandar Ružičić wrote:
On Thu, Apr 7, 2011 at 7:27 PM, spir wrote:
how are we supposed to insert "code phrases" in the
flow of normal text?
tags should be used for that
(http://www.w3.org/TR/html401/struct/text.html#h-9.2.1).
Right, but IIUC unlike t
On 04/07/2011 08:12 PM, Steven Schveighoffer wrote:
On Thu, 07 Apr 2011 13:09:05 -0400, spir wrote:
Hello,
I'm trying to use C's memmove as a tool to delete or insert a slice from/into
an array. But I cannot manage to do it: systematic segmentation fault.
What is wrong belo
On 04/07/2011 03:32 PM, Jacob Carlborg wrote:
On 2011-04-07 12:25, spir wrote:
On 04/07/2011 10:20 AM, spir wrote:
Hello,
In D stdlib's ddoc the idiom "$(D some d code) is constantly used. But
it does
not work by me. Not only it's not interpreted, but the contents are
s
Hello,
I'm trying to use C's memmove as a tool to delete or insert a slice from/into
an array. But I cannot manage to do it: systematic segmentation fault.
What is wrong below?
import std.c.string : memmove;
// void *memmove(void *dest, const void *src, size_t n);
void moveEnd (E) (E[] elemen
On 04/07/2011 12:53 PM, bearophile wrote:
spir:
I take the opprtunity to ask another question: does anyone know how to tag a
*span* of text as literal/uninterpreted (either in html or css). The issue is
makes a *block*, even if not inside a or; I desperately need
the same feature for inline
On 04/07/2011 10:20 AM, spir wrote:
Hello,
In D stdlib's ddoc the idiom "$(D some d code) is constantly used. But it does
not work by me. Not only it's not interpreted, but the contents are stripped
out all together. (A *very* big bug of ddoc.)
First, I'd like to know w
Hello,
In D stdlib's ddoc the idiom "$(D some d code) is constantly used. But it does
not work by me. Not only it's not interpreted, but the contents are stripped
out all together. (A *very* big bug of ddoc.)
First, I'd like to know why.
Second, there is another pattern $(D_CODE some d code),
On 04/07/2011 09:52 AM, spir wrote:
On 04/07/2011 03:07 AM, Ali Çehreli wrote:
Given an array of strings std.string.join() returns a single string:
import std.string;
void main() {
string[] a1 = ["hello", "red"];
string j1 = join(a1, " "); // OK
}
But in a prog
On 04/07/2011 09:52 AM, spir wrote:
On 04/07/2011 03:07 AM, Ali Çehreli wrote:
Given an array of strings std.string.join() returns a single string:
import std.string;
void main() {
string[] a1 = ["hello", "red"];
string j1 = join(a1, " "); // OK
}
But in a prog
On 04/07/2011 03:07 AM, Ali Çehreli wrote:
Given an array of strings std.string.join() returns a single string:
import std.string;
void main() {
string[] a1 = ["hello", "red"];
string j1 = join(a1, " "); // OK
}
But in a program I need an array of mutable arrays of chars. If I
On 04/06/2011 11:53 AM, Kagamin wrote:
spir Wrote:
Hello,
I get this error message:
Not the start of the UTF-8 sequence
without any other comment module name or whatnot.
This happens when I just added toString to the following struct, and used it:
struct Node
Hello,
I get this error message:
Not the start of the UTF-8 sequence
without any other comment module name or whatnot.
This happens when I just added toString to the following struct, and used it:
struct Node {
// Note: level is equal to the number of chars up to this node.
On 04/03/2011 04:29 PM, simendsjo wrote:
On 03.04.2011 14:55, spir wrote:
On 04/03/2011 02:29 PM, simendsjo wrote:
D will copy the original content if a slice expands, but is the
following behavior
implementation specific, or part of the specification?
auto a = [0,1,2];
auto b = a[0..2
On 04/03/2011 02:29 PM, simendsjo wrote:
D will copy the original content if a slice expands, but is the following
behavior
implementation specific, or part of the specification?
auto a = [0,1,2];
auto b = a[0..2];
a.length = 2; // is a[3] already marked for collection b
On 04/03/2011 09:38 AM, Jesus Alvarez wrote:
I got it to compile adding std.regex to split to make it:
auto words = std.regex.split (sentence, regex("[ \t,.;:?]+"));
So now my question is, is this an error in the book? The errata doesn't
mention anything about this section.
If the TDPL code d
On 04/02/2011 12:14 AM, enuhtac wrote:
template isA( T )
{
static if( is( T U == A!( U, s ), string s ) )
enum bool isA = true;
else
enum bool isA = false;
};
What does ", string s" do here inside the is expression?
Denis
--
_
vita es estrany
spir.wi
On 04/01/2011 11:03 PM, Andrej Mitrovic wrote:
At least on Windows, as far as I know, the casing of a file extension doesn't
come into play. But when comparing extensions, you have to be careful to
lowercase the result of `getExt()`, for example:
foreach (string name; dirEntries(curdir, SpanMo
On 04/01/2011 12:38 PM, Regan Heath wrote:
On Mon, 28 Mar 2011 17:54:29 +0100, bearophile wrote:
Steven Schveighoffer:
So essentially, you are getting the same thing, but using [] is slower.
It seems I was right then, thank you and Kagamin for the answers.
This may be slightly OT but I ju
On 03/31/2011 02:40 AM, Aleksandar Ružičić wrote:
2011/3/31 Aleksandar Ružičić:
Or maybe there is some other way to achive what I want and I'm not
aware of it? :-)
I know I could have used opIndex and opIndexAssign but I really want
config.section.entry syntax instead of config["section"]["e
On 03/30/2011 03:31 PM, Steven Schveighoffer wrote:
On Tue, 29 Mar 2011 22:20:05 -0400, Nick Sabalausky wrote:
"spir" wrote in message
news:mailman.2909.1301443345.4748.digitalmars-d-le...@puremagic.com...
On 03/30/2011 01:24 AM, Nick Sabalausky wrote:
My understanding of hash
On 03/30/2011 05:32 AM, Ali Çehreli wrote:
On 03/29/2011 03:40 PM, Kai Meyer wrote:
I was given two words of advice on exceptions:
"Use exceptions for the exceptional"
"Use exceptions only for the exceptional"
Those advices are given by wise people: they are wise only because they leave
th
On 03/30/2011 01:24 AM, Nick Sabalausky wrote:
My understanding of hash tables is that they allocate a fixed size array and
map keys to indicies within the range 0..predefined_length_of_the_AA.
So I've been wondering, how many elements do D's built-in AAs have? And
what's the content of each one
On 03/29/2011 08:49 PM, Steven Schveighoffer wrote:
On Tue, 29 Mar 2011 14:40:02 -0400, Mike Linford
wrote:
Hello,
So I'm writing a function for a library. It takes a struct as an
argument. The struct's fields can't just be any old values, though. The
function won't work if some of the fields
On 03/29/2011 12:43 PM, Ishan Thilina wrote:
I'm using GDC because I can't use DMD in linux. I have started a seperate thread
for that.
I'm using dmd on Linux without any issue. But only stable releases (several
versions have passed).
May I suggest you take some time to uninstall everything p
On 03/28/2011 04:49 PM, Ishan Thilina wrote:
now I get a whole lot more errors :s.
"
ishan@ishan-Ubu-I1464:~/Geany Projects$ dmd untitle.d
/usr/include/d/dmd/phobos/object.d(51): C-style function pointer and pointer to
array syntax is deprecated. Use 'function' to declare function pointers
/usr
On 03/28/2011 05:43 AM, Ishan Thilina wrote:
@ David:
I'm looking for example code that explains specific pieces of functionality :)
@Lutger:
Those two links were really helpful :). Thank you :)
There are tutorial examples of D code at DSource; they were initially D1, but
many of them are c
On 03/27/2011 12:28 PM, Ishan Thilina wrote:
When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
the following error.
"
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = /etc/../../src/phobos
import path[1] = /etc/../../src/drun
On 03/27/2011 12:28 PM, Ishan Thilina wrote:
When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
the following error.
"
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = /etc/../../src/phobos
import path[1] = /etc/../../src/drun
On 03/25/2011 12:08 PM, Regan Heath wrote:
On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis
wrote:
There are tasks for which you need to be able to lex and parse D code. To
100% correctly remove unit tests would be one such task.
Is that last bit true? You definitely need to be able to l
On 03/25/2011 06:18 AM, Ishan Thilina wrote:
Hi,
I'm still new to D. I tried to implement a stack using templates. But I get an
"Access Violation" error when I try to run a test on the stack that I made.The
source code is attached with this mail. Can somebody please point out the
error of this c
On 03/25/2011 01:50 AM, bearophile wrote:
A little quiz for people here: guess the output of this little D2 program (it
compiles correctly and doesn't crash at run time, so it's a fair question):
import std.typecons: tuple;
import std.c.stdio: printf;
auto foo() {
printf("foo\n");
r
On 03/24/2011 08:53 AM, Alexey Prokhin wrote:
Currently, as far as I know, there are only two lexers and two parsers for
D: the C++ front end which dmd, gdc, and ldc use and the D front end which
ddmd uses and which is based on the C++ front end. Both of those are under
the GPL (which makes th
On 03/20/2011 04:40 PM, bearophile wrote:
Do you ever desire literals for byte, ubyte, short and ushort integrals (beside
the currently present for int, uint, long, ulong that are 10, 10U, 10L, 10UL)?
Because of the more strict typing of templates in some situations I have had to
write things
On 03/18/2011 10:29 AM, Peter Alexander wrote:
On 13/03/11 12:05 AM, Jonathan M Davis wrote:
So, when you're using a range of char[] or wchar[], you're really using a range
of dchar. These ranges are bi-directional. They can't be sliced, and they can't
be indexed (since doing so would likely be
On 03/16/2011 06:41 AM, Jesse Phillips wrote:
Ali Çehreli Wrote:
Right? Is there a better way that I am missing?
Thank you,
Ali
No better way, the stated reason IIRC is that it is easier to remove the new
line then to append it back on.
May be stated, but it is very wrong! I guess:
s
On 03/16/2011 06:05 AM, Ali Çehreli wrote:
I am going over some sample programs in a text of mine and replacing
std.cstream references with std.stdio. There are non-trivial differences with
formatted input.
The following program may be surprising to the novice:
import std.stdio;
void main()
{
On 03/14/2011 12:21 PM, Nebster wrote:
Hey,
I'm having some problems iterating over an enumerated associative array.
It comes up with this error at compile time:
Internal error: e2ir.c 4835
I cut the code down to this:
import std.stdio;
enum int[string] assoc = [";": 0, "=": 1, "+": 2, "
On 03/14/2011 07:55 AM, Gene P. Cross wrote:
-Daniel
I tried what you said:
char* ptr = toStringz(path);
SDL_LoadBMP(ptr);
and made a check to see if the pointer is null, which it isn't, but I'm unable
to
inspect is value, I haven't a debugger at the moment, could you recommend one ?
I also m
On 03/13/2011 07:58 PM, Magnus Lie Hetland wrote:
For some reason, it seems like expressions of the form "foo.bar !in baz" aren't
allowed. I suspect this is a grammar/parser problem -- the bang is interpreted
as a template argument operator, rather than a negation operator, and there's
really no
On 03/13/2011 01:05 AM, Jonathan M Davis wrote:
If you were to try and iterate over a char[] by char, then you would be looking
at code units rather than code points which is _rarely_ what you want. If you're
dealing with anything other than pure ASCII, you _will_ have bugs if you do
that. You're
On 03/10/2011 11:01 PM, bearophile wrote:
While creating the rotation code I have found two things I don't understand.
Maybe some of you is able to help me understand.
This version of the code:
union Four {
uint u;
ubyte[4] a;
}
void main() {
Four f;
asm {
rol f.u
On 03/10/2011 01:44 AM, Charles McAnany wrote:
Hi, all. I'm in college, taking a freshman-level CS class. (I'm actually a
senior chemist with free time.)
Anyhoo, the warm-up assignment was Hardy Taxi problem, phrased like this:
[Exposition removed.] 1729 is the smallest number such that for
(a!=b
On 03/10/2011 12:19 AM, Joel Christensen wrote:
This is on Windows 7. Using a def file to stop the terminal window coming up.
win.def
EXETYPE NT
SUBSYSTEM WINDOWS
bug.d
import std.stdio;
import std.string;
void main() {
auto f = File( "z.txt", "w" );
scope( exit )
f.close;
string foo = "bar";
On 03/10/2011 12:55 AM, Jonathan M Davis wrote:
I don't know of anything more efficient than:
>ubyte[4] bytes = [1,2,3,4];
>bytes = bytes[$-1] ~ bytes[0..$-1]; // Rotate left
I'm stunned that this works. I'd even consider reporting it as a bug. You're
concatenating a ubyte[] ont
On 03/08/2011 11:57 PM, Steven Schveighoffer wrote:
On Tue, 08 Mar 2011 17:48:37 -0500, Tom wrote:
http://d.puremagic.com/issues/show_bug.cgi?id=5603
This is really sad. This kind of stuff is a must for performance. D is
disappointing me too much yet :(
There is always c's malloc, or you c
On 03/08/2011 06:56 PM, Andrej Mitrovic wrote:
module test;
struct MyArray(T)
{
private T[] data;
bool opCast(T)() if (is(T == bool))
{
return !data.empty;
}
}
void main()
{
auto foo = MyArray!(int)();
auto state = foo ? true : false;
}
test.d(13): Error
On 03/08/2011 06:20 PM, Steven Schveighoffer wrote:
On Tue, 08 Mar 2011 12:06:08 -0500, Andrej Mitrovic wrote:
import std.stdio;
import std.traits;
import std.exception;
struct CheckedInt(N) if (isIntegral!N)
{
private N value;
ref CheckedInt opUnary(string op)() if (op == "++")
{
enforce(val
On 03/08/2011 03:48 PM, Jonathan M Davis wrote:
I really don't understand your problem with module constructors. They're
fantastic.
I may be wrong, but I think this point of view is a "where I can from"
statement. C's char* are fantastic when you have never used a PL with builtin
strings. The
On 03/08/2011 09:26 AM, Wilfried Kirschenmann wrote:
enum deviceType {cpu, gpu}
auto execDeviceSuffix = [deviceType.cpu:".cpu", deviceType.gpu:".gpu"];
The way to get what you want to work in this case is to use a module
constructor. So, you'd do something like this:
string[deviceType] execDe
On 03/07/2011 03:22 AM, Peter Lundgren wrote:
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Sunday 06 March 2011 14:05:04 Peter Lundgren wrote:
Can you define an associative array in a way that can be evaluated at
compile time like you can with non-associative arrays?
I'm p
On 03/05/2011 01:58 PM, bearophile wrote:
Jonathan M Davis:
Asserts are for
debugging, testing, and verifying code when developing, not for code which is
released.
If you take a look at the dmd compiler, it's released with asserts in, and they
give all those nice error messages I put in Bugz
On 03/05/2011 04:02 AM, Peter Lundgren wrote:
I have a function that I think should look something like this:
MyStruct!T myFunc(T)(MyStruct!T x, ...) {
...
return MyStruct!T(...);
}
and the closest I can get to is:
T myFunc(T)(T x, ...) {
...
return T(...);
}
w
On 03/04/2011 07:06 PM, Jonathan M Davis wrote:
On Friday, March 04, 2011 09:13:34 spir wrote:
On 03/04/2011 05:43 PM, Steven Schveighoffer wrote:
On Fri, 04 Mar 2011 11:29:08 -0500, Magnus Lie Hetland
wrote:
From what I understand, when you override iteration, you can either
implement the
On 03/04/2011 05:43 PM, Steven Schveighoffer wrote:
On Fri, 04 Mar 2011 11:29:08 -0500, Magnus Lie Hetland
wrote:
From what I understand, when you override iteration, you can either implement
the basic range primitives, permitting foreach to destructively iterate over
your object, or you can
On 03/04/2011 05:01 PM, Magnus Lie Hetland wrote:
I'm writing a collection with functionality for membership checking. I thought
it would be nice to use the "in" operator. In the docs for std.collections I
surmise that this is the standard way to go. From the source code, I see
there's no special
On 03/03/2011 05:56 AM, Peter Lundgren wrote:
Where can I go to learn about parameterized structs? I can't seem to find any
literature on the subject. In particular, what are you allowed to use as a
parameter? I would like to define a struct like so:
struct MyStruct(T, T[] a) {
...
}
but I
On 03/03/2011 12:25 PM, bearophile wrote:
Ali Çehreli:
Template value parameter types can be any type which can be statically
initialized at compile time, and the value argument can be any
expression which can be evaluated at compile time. This includes
integers, floating point types, and stri
On 03/03/2011 05:56 AM, Peter Lundgren wrote:
Where can I go to learn about parameterized structs? I can't seem to find any
literature on the subject. In particular, what are you allowed to use as a
parameter? I would like to define a struct like so:
struct MyStruct(T, T[] a) {
...
}
but I
On 03/02/2011 02:24 PM, Steven Schveighoffer wrote:
On Tue, 01 Mar 2011 18:11:00 -0500, bearophile wrote:
http://d.puremagic.com/issues/show_bug.cgi?id=5678
I think there is a general bug where any time the compiler uses an enum, it
simply replaces the expression declared for the enum.
So b
Hello,
It seems to be the kind of stupid issue that will make you laugh about me. But
I cannot grasp and want to move forward anyway; so, let us be bold and take the
risk ;-)
I'm modeling a little dynamic language. Elements (values, objects) are pointers
to structs (actually tagged unions) a
On 03/01/2011 07:58 AM, Peter Lundgren wrote:
I'm trying to use mixins to generate an array of numbers that are coprime to a
statically known value. I've tried the following, but I receive the error:
Error: to(i) ~ ", " cannot be interpreted at compile time
string makePossibleAValues(string na
1 - 100 of 413 matches
Mail list logo