out(result) {}
run fine, if foo() return 0, an exception is throw by assert()
but in doesn't work. I don't know what I'm missing. It' my first
time using contracts
I'm learning to use interface with contracts. In below code, in
isn't being "called". Can someone point out why? what am I doing
wrong?
void main() {
C c = new C();
writeln(c.foo(1));
}
interface I
{
int foo(int i)
in { assert(i > 2); }
o
On Tuesday, 14 November 2017 at 08:21:59 UTC, Tony wrote:
On Tuesday, 14 November 2017 at 07:56:06 UTC, rikki cattermole
wrote:
On 14/11/2017 7:54 AM, Tony wrote:
Is there an easy way to get the string representation of an
array, as would be printed by writeln(), but captured in a
string?
st
I'm using below resource file as the following:
"C:\dm\bin\rcc.exe" -32 -D__NT__ res.rc
dmd -m32 -debug app.d res.res
The icon is the only thing that is set. Everything else is
missing from application's attributes. What am I missing?
res.rc:
IDI_ICON1 ICONDISCARDABLE "my.
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote:
Hey guys, if I were to get into dmd's source code to play a
little bit (just for fun, no commercial use at all), which
books/resources do you recommend to start out?
I'd like something on back-end too, for example, code generat
Hey guys, if I were to get into dmd's source code to play a
little bit (just for fun, no commercial use at all), which
books/resources do you recommend to start out?
On Tuesday, 31 October 2017 at 15:20:31 UTC, Igor Shirkalin wrote:
On Tuesday, 31 October 2017 at 14:54:27 UTC, Dr. Assembly wrote:
On Tuesday, 31 October 2017 at 13:53:54 UTC, Jacob Carlborg
wrote:
On 2017-10-31 14:46, Igor Shirkalin wrote:
[...]
The only alternative is to do something like
On Tuesday, 31 October 2017 at 13:53:54 UTC, Jacob Carlborg wrote:
On 2017-10-31 14:46, Igor Shirkalin wrote:
Hello!
We need some conditional compilation using 'version'.
Say we have some code to be compiled for X86 and X86_64.
How can we do that using predefined (or other) versions?
Examples:
I believe it's a design choice, if so, could someone explain why?
is immutable better than C#'s readonly so that the readonly
keyword isn't even needed? for example, I'd like to declare a
member as readonly but I can't do it directly because immutable
create a new type (since it's a type specif
On Friday, 26 June 2015 at 22:14:56 UTC, Adam D. Ruppe wrote:
On Friday, 26 June 2015 at 21:50:30 UTC, Assembly wrote:
class Baa {
Foo a = new Foo();
Foo b = new Foo();
Foo[] l = [a,b];
I wasn't aware about this. I'm used to have static only when I
request so, like using static keyword
Imaginary code:
class Foo { }
class Baa {
Foo a = new Foo();
Foo b = new Foo();
Foo[] l = [a,b];
}
What should I use instead of to it work? Array!Foo(a,b) didn't
worked either.
I know this works:
class Baa {
Foo a = new Foo();
Foo b = new Foo();
Foo[] l;
this() {
l = [a,b];
}
But
What's a fast way to insert an element at index 0 of array? now
that the code is working I want to clean this:
void push(T val)
{
T[] t = new T[buffer.length + 1];
t[0] = val;
t[1 .. $] = buffer;
buffer = t;
}
I did
On Monday, 22 June 2015 at 20:34:00 UTC, anonymous wrote:
On Monday, 22 June 2015 at 18:44:22 UTC, Assembly wrote:
I'm using this, thanks for all. Can someone clarify how does
opApply() works? I assume it's called every iteration and as
opApply() has a loop does it means the number of iteration
On Monday, 22 June 2015 at 18:07:36 UTC, Ali Çehreli wrote:
On 06/22/2015 10:03 AM, Assembly wrote:
> foreach(int i, MyType p; places) {
>
> but I get this error:
>
> Error: cannot infer argument types, expected 1 argument, not 2
Yeah, the loop counter is automatic only for slices. You can
use
On Monday, 22 June 2015 at 17:09:16 UTC, Steven Schveighoffer
wrote:
On 6/22/15 1:03 PM, Assembly wrote:
[...]
TBH, opApply is much better suited to classes.
But in order to have multiple parameters with foreach by using
a range, you must return a tuple:
auto front() { import std.typecons:
On Monday, 22 June 2015 at 16:52:15 UTC, Ali Çehreli wrote:
On 06/22/2015 09:37 AM, q66 wrote:
use opApply.
Yes. Additionally, an InputRange interface can be used:
http://ddili.org/ders/d.en/foreach_opapply.html
Ali
I was reading exaclty this page that.
I've had implmented this method/
Does D has an equivalent to C#'s iterator
(https://msdn.microsoft.com/en-us/library/65zzykke.aspx)? if so,
where can I find it?
What I want is loop over a user-defined class/struct. In case of
C#, I just implement the IEnumerable and the GetEnumerator()
methods that's called by the foreach()
On Monday, 22 June 2015 at 08:18:08 UTC, Adrian Matoga wrote:
On Monday, 22 June 2015 at 06:09:48 UTC, Assembly wrote:
Does D has built-in stack structure (if so, which module?) or
should I implement it myself?
AFAIK there's no built-in, but std.array.Appender could be
easily wrapped in an in
Does D has built-in stack structure (if so, which module?) or
should I implement it myself?
On Sunday, 31 May 2015 at 21:32:34 UTC, Ali Çehreli wrote:
On 05/31/2015 02:30 PM, Assembly wrote:
So after a while without write any D code (such a sad time)
I'm back. I
needed to use appender but it returned a compile error:
template instance template 'appender' is not defined
I've import
I'm aware about format() from std.string but I have some code
written which uses appender and I'm a bit affraid that this won't
compile anymore
So after a while without write any D code (such a sad time) I'm
back. I needed to use appender but it returned a compile error:
template instance template 'appender' is not defined
I've imported the std.format module but it still doesn't works.
What changed? did this moved to somewhere else
22 matches
Mail list logo