On Thursday, 19 November 2015 at 15:36:44 UTC, Steven
Schveighoffer wrote:
On 11/19/15 3:30 AM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Wednesday, November 18, 2015 22:15:19 anonymous via
Digitalmars-d-learn wrote:
On 18.11.2015 22:02, rsw0x wrote:
slices aren't arrays
http://dlang.
On Wednesday, 4 November 2015 at 21:22:04 UTC, ixid wrote:
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin
wrote:
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to
int when you're using shorter types?
Only
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
Only with library solution. Implicit conversions are built into
language.
On Wednesday, 21 October 2015 at 12:05:27 UTC, Shriramana Sharma
wrote:
import std.math;
real round(real val, int prec)
{
real pow = 10 ^^ prec;
return round(val * pow) / pow;
}
Trying to compile this I get:
foo.d(5): Error: function foo.round (real val, int prec) is not
callable using
On Thursday, 22 October 2015 at 13:29:06 UTC, DarkRiDDeR wrote:
I don't need the base class data. How to create a array of
subclasses objects with the derived data members?
The language is implemented in this way. You have already have
the answer:
writeln(Core.users.name)
Out:
USERS
On Thursday, 22 October 2015 at 11:02:05 UTC, DarkRiDDeR wrote:
This variant works strangely. Example:
abstract class Addon
{
public string name = "0";
}
class Users: Addon
{
override
{
public string name = "USERS";
}
}
static final class Core
{
On Wednesday, 21 October 2015 at 19:49:35 UTC, Ali Çehreli wrote:
On 10/21/2015 12:37 PM, Sigg wrote:
> cause at least few more "fun" side effects.
One of those side effects would be function calls binding
silently to another overload:
void foo(bool){/* ... */}
void foo(int) {/* ... */}
a
On Wednesday, 21 October 2015 at 22:49:16 UTC, Marco Leise wrote:
Am Wed, 21 Oct 2015 12:49:35 -0700
schrieb Ali Çehreli :
On 10/21/2015 12:37 PM, Sigg wrote:
> cause at least few more "fun" side effects.
One of those side effects would be function calls binding
silently to another overload
On Sunday, 14 June 2015 at 01:20:39 UTC, Timothee Cour wrote:
I understand this is legal for declaration wo definition (void
fun(int);)
but why allow this:
void test(int){} ?
Actually it is void test(int _param_0) { }
You can test by compiling void test(int) { _param_0 = 0; }
Nameless paramet
On Saturday, 23 May 2015 at 10:57:22 UTC, Suliman wrote:
Every D program is started as if it were a C program.
Why is so necessary?
What about C++ and other languages? Does they have more then
one main?
Why it's more than one main is needed? Why D apps can't start
with single main?
You co
On Thursday, 14 May 2015 at 09:53:20 UTC, Per Nordlöw wrote:
At
https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L43
I've implemented a function either() with behaviour similar to
the `or` function/operator in dynamic languages such as Python
and Lisp.
I'm almost satisified with
On Saturday, 28 June 2014 at 20:40:21 UTC, Ary Borenszweig wrote:
This doesn't work:
class Foo {
this() {
this = new Foo;
}
}
Error: Cannot modify 'this'
However you can do this:
class Foo {
this() {
auto p = &this;
*p = new Foo();
}
}
It even changes the value of this!
On Monday, 24 February 2014 at 14:14:43 UTC, Tobias Pankrath
wrote:
On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote:
Hi,
right now I am truing to figure out how the constructors
behave in D2.
Question 1: why it is not possible to create custom ctor for
struct?
The design of D reli
On Monday, 24 February 2014 at 19:41:57 UTC, Remo wrote:
For Vector example this works pretty well this way.
But my main problem is more complicated.
extern(C) int init(ref CWrapper p);
extern(C) void free(ref CWrapper p);
struct CWrapper
{
//some data that must be the same at C side.
Data
On Saturday, 22 February 2014 at 17:22:51 UTC, andrea9940 wrote:
Hi everyone,
I was trying to get my vector struct to use extensively
references for passing parameters and I found a subtle bug
which make me lose a few hour.
A sample code that shows the bug is here
http://pastebin.com/rvcNdjA
On Saturday, 22 February 2014 at 17:41:58 UTC, Ali Çehreli wrote:
The code uses the two objects through the A interface and x()
is a virtual function on that interface.
When the C interface is used then we get C.x, which happens to
be hiding the x() function of the base class.
It looks nor
On Thursday, 30 January 2014 at 16:48:51 UTC, Cooler wrote:
On Thursday, 30 January 2014 at 16:18:33 UTC, Steven
Schveighoffer wrote:
void foo(int x)
{
x = 5;
}
"hey, why doesn't that work! Setting a parameter to another
value should be illegal!"
-Steve
Please understand - I am not again
On Thursday, 30 January 2014 at 10:49:42 UTC, Cooler wrote:
Now I am trying to speak ideally. What ideal language should
be, not the practical implementation.
...
Again - don't look back. Consider how we can make D better.
...
Again - stop consider current state of D implementation.
Consid
On Thursday, 30 January 2014 at 09:14:43 UTC, Cooler wrote:
If you want to modify the slice and make changes visible in
caller, you should use ref. If you don't care whether changes
are visible in caller, you can omit any attributes and use
plain array. This belongs to the case you are asking a
On Wednesday, 29 January 2014 at 16:26:05 UTC, Cooler wrote:
On Wednesday, 29 January 2014 at 16:15:36 UTC, Tobias Pankrath
wrote:
On Wednesday, 29 January 2014 at 16:01:08 UTC, Cooler wrote:
Do you read my post? I am answering... why do I need fun3()
if I already have fun1() and fun2().
fu
On Monday, 20 January 2014 at 09:58:07 UTC, Jakob Ovrum wrote:
On Thursday, 16 January 2014 at 06:59:43 UTC, Maxim Fomin wrote:
This is wrong. String in D is de facto (by implementation,
spec may say whatever is convenient for advertising D) array
of single bytes which can keep UTF-8 code
On Sunday, 19 January 2014 at 20:46:06 UTC, monarch_dodra wrote:
I think the behavior is not *strictly* incorrect: When you
write:
sup = a;
it triggers a postblit of "a" into "sup". To do said postblit,
you destroy sup. It's the way it works :/
Arguably, since it is initialization, we coul
On Thursday, 16 January 2014 at 05:56:48 UTC, Jakob Ovrum wrote:
On Tuesday, 14 January 2014 at 11:42:34 UTC, Maxim Fomin wrote:
The root of the issue is that string literals containing
characters which do not fit into signle byte are still
converted to char[] array. This is strictly speaking
On Monday, 13 January 2014 at 23:10:04 UTC, TheFlyingFiddle wrote:
I'm curious, why is the .front property of narrow strings of
type dchar?
And not the underlying character type for the string.
The root of the issue is that string literals containing
characters which do not fit into signle by
On Saturday, 11 January 2014 at 17:50:01 UTC, Eric wrote:
Apparently the line,
static shared static int x;
will compile just fine. Is this sort of a bug,
or does it mean something different from just
static shared int x;
?
Also, the line,
static static static int x;
will also compile. Do
On Friday, 13 December 2013 at 04:13:04 UTC, Kenji Hara wrote:
On Thursday, 12 December 2013 at 18:20:25 UTC, bearophile wrote:
If I have a function foo that takes a slice as input, and I
want to pass it two arrays, the first time allocated on the
heap and the second on the stack, I have to use
On Thursday, 5 December 2013 at 19:51:52 UTC, Ary Borenszweig
wrote:
But to make array.length uint by default and have these
surprises all of the time just because "a negative length
doesn't make sense"... I don't know, I feel it's not the right
way to do it.
Length of array type is not uin
On Thursday, 5 December 2013 at 18:26:48 UTC, Jonathan M Davis
wrote:
On Thursday, December 05, 2013 19:16:29 Maxim Fomin wrote:
On Thursday, 5 December 2013 at 17:15:39 UTC, Steve Teale
wrote:
> Is this unavoidable, or could the compiler safely make the
> conversion implicitly?
It is e
On Thursday, 5 December 2013 at 17:15:39 UTC, Steve Teale wrote:
Is this unavoidable, or could the compiler safely make the
conversion implicitly?
It is example of notorious phenomemena called "integer
promotions" and "usual arithmetic conversions". It is unavoidable
given Walter's decision
On Tuesday, 3 December 2013 at 08:28:23 UTC, Ali Çehreli wrote:
That works for some types as both enum and immutable have their
problems:
* enum is no good for arrays and AAs as it is very likely to be
unnecessarily slow.
* immutable is no good for types that contain mutable
references at
On Friday, 29 November 2013 at 00:41:16 UTC, bearophile wrote:
H. S. Teoh:
Modifying the loop variable of a foreach is, in general, a
risky move.
Right. In my opinion D programmers should learn that this is
the preferred idiom of using foreach ranged loops:
foreach (immutable i; 0 .. n) {}
On Monday, 2 December 2013 at 13:30:44 UTC, Atila Neves wrote:
Bug or feature? This one caught me by surprise:
void main() {
{
int[string] aa[string];
aa["foo"]["bar"] = 1;
assert(aa["foo"]["bar"] == 1); //ok
auto aa2 = aa;
aa2["boo"]["dar"] = 2;
On Monday, 2 December 2013 at 07:27:25 UTC, Ali Çehreli wrote:
On 12/01/2013 09:57 PM, CJS wrote:
> I was reading the enum page of Ali Çehreli's (excellent) D
book
> (http://ddili.org/ders/d.en/enum.html), and I'm confused by
an enum
> value (not enum type), such as
> enum secondsPerDay = 60
On Friday, 29 November 2013 at 16:48:58 UTC, Temtaime wrote:
Hi !
http://dpaste.dzfl.pl/53d9a59e
How i can enforce that ~A will be called after ~B ?
I'm writing 3D engine and it's critical to me.
Thanks for yours aid !
It is impossible to do this directly given current gc
implementation, bu
On Monday, 18 November 2013 at 16:03:33 UTC, Namespace wrote:
On Monday, 18 November 2013 at 15:27:46 UTC, Maxim Fomin wrote:
I think there is bigger problem (and bigger memory error)
here. When you inside struct method load pointer to some field
you cannot rely that after leaving the method
On Monday, 18 November 2013 at 14:15:02 UTC, Namespace wrote:
On Monday, 18 November 2013 at 10:09:12 UTC, qznc wrote:
On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote:
I found another approach. It avoids the GC and the Heap: A
Circular Buffer:
http://dpaste.dzfl.pl/cf1e7afb
That
On Saturday, 16 November 2013 at 14:14:24 UTC, Piotr Podsiadły
wrote:
Hello,
I'm trying to use setjmp and longjmp on Windows with DMD
compiler (version 2.064). When compiled as 64-bit application,
it works, but 32-bit version crashes inside longjmp. What
should be changed to get it to work?
On Wednesday, 6 November 2013 at 18:02:32 UTC, Ali Çehreli wrote:
> But such
> expectations need not correspond to language rules (try to
think from
> from language laywer perspective).
I still argue that the expression -expr must have the same type
as expr.
> In bearophile case, I guess
> Ty
On Wednesday, 6 November 2013 at 17:49:41 UTC, H. S. Teoh wrote:
The GC will take care of cleaning up the old data.
T
Unfortunately it will not take care of calling struct destructors.
On Wednesday, 6 November 2013 at 17:10:34 UTC, Ali Çehreli wrote:
I would be very surprised if unary "-" produced a different
type from the operand:
Ali
Operator does not produce type, it produces value of expression,
and type of expression happens not to be the type you expected.
But suc
On Saturday, 2 November 2013 at 21:28:46 UTC, Adam D. Ruppe wrote:
On Saturday, 2 November 2013 at 20:45:28 UTC, TheFlyingFiddle
wrote:
I'm basically wondering why the __traits keyword looks so
horrible.
I think it looks beautiful and wished all the keywords used the
leading underscores.
Th
On Thursday, 31 October 2013 at 18:51:46 UTC, bearophile wrote:
Maxim Fomin:
You can check whether data is on heap, stack, tls, or just
global object by inspecting pointer at runtime. Ideally there
would be such function in druntime.
This seems like a nice enhancement request for Bugzilla
On Thursday, 31 October 2013 at 17:22:07 UTC, Daniel Davidson
wrote:
I'm think you may be correct... but what specifically is
incorrect about the language?
When I see __fieldPostBlit I get the feeling it is more an
implementation issue than the language.
__postblit also looks like implementa
On Thursday, 31 October 2013 at 17:34:21 UTC, Daniel Davidson
wrote:
On Thursday, 31 October 2013 at 16:16:36 UTC, bearophile wrote:
That's wrong code, you are escaping a reference to memory (of
rc variable) allocated in the stack frame of foo(). The D
compiler is not smart enough to recogniz
On Thursday, 31 October 2013 at 15:11:48 UTC, Daniel Davidson
wrote:
The following seems to work, but feels like luck. When foo
returns rc should be taken off the stack. If I recall, in C++
something like this would crash, but why not here?
This ineed runs by luck. In C++ it would not necessar
On Thursday, 31 October 2013 at 14:03:28 UTC, Daniel Davidson
wrote:
Given this code:
import plus.tvm.rate_curve;
struct T {
RateCurve m;
}
struct S {
const(T) rc;
}
I get this error: Error: mutable method
plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not
callable
On Tuesday, 29 October 2013 at 21:24:35 UTC, bearophile wrote:
Maxim Fomin:
Bools being integer types is reason of your problem with enums.
The reason of that problem of mine with enums is that they
convert implicitly to integers. And I still don't know the
original rationale of Walt
On Tuesday, 29 October 2013 at 18:23:03 UTC, bearophile wrote:
Ali Çehreli:
>> enum Foo { A, B, C }
>> void main() {
>>bool[5] bools;
>>auto b = bools[2] != Foo.C;
>>bools[2] = Foo.A;
>> }
...
There was a long discussion about that. Walter was happy that
bool was a integer type. Ma
On Tuesday, 29 October 2013 at 17:57:01 UTC, Ali Çehreli wrote:
On 10/29/2013 08:47 AM, Maxim Fomin wrote:
On Monday, 28 October 2013 at 20:43:01 UTC, Ali Çehreli wrote:
What is the purpose of writeln in that delegate? Obviously,
to print
1. Yet it doesn't happen that way. Is this acc
On Tuesday, 29 October 2013 at 12:43:17 UTC, bearophile wrote:
This code is accepted by the D compiler:
enum Foo { A, B, C }
void main() {
bool[5] bools;
auto b = bools[2] != Foo.C;
bools[2] = Foo.A;
}
Who is that likes such kind of code? What are the advantages of
accepting such
On Tuesday, 29 October 2013 at 12:03:09 UTC, Rene Zwanenburg
wrote:
On Monday, 28 October 2013 at 19:40:26 UTC, Maxim Fomin wrote:
The fact that structs are movable and there is too few struct
runtime reflection makes them noncollectable. However, you can
wrap struct inside class, in such case
On Tuesday, 29 October 2013 at 11:46:53 UTC, Rene Zwanenburg
wrote:
That's pretty nasty :). But I suspect this is a bug and not by
design. __dtor and __traits are, IMHO, the proverbial escape
hatch D should provide, so I think that's OK. I take it that by
control flow trick you mean the try/c
On Monday, 28 October 2013 at 20:43:01 UTC, Ali Çehreli wrote:
What is the purpose of writeln in that delegate? Obviously, to
print 1. Yet it doesn't happen that way. Is this accepted to be
a bug? Should the programmer 'new' the object instead?
Ali
In my opinion it is a corner case, a cons
On Monday, 28 October 2013 at 10:07:15 UTC, Rene Zwanenburg wrote:
On Sunday, 27 October 2013 at 23:33:55 UTC, Ali Çehreli wrote:
That's news to me. I know that objects may never be destroyed
but why multiple times? How many lives do they have? ;)
Yeah, I'd like to know this as well. I do reme
On Monday, 28 October 2013 at 16:53:11 UTC, monarch_dodra wrote:
On Monday, 28 October 2013 at 10:07:15 UTC, Rene Zwanenburg
wrote:
Yeah, I'd like to know this as well. I do remember structs
allocated on the heap don't have their destructors called at
all due to the GC not being precise, I thin
On Monday, 28 October 2013 at 12:10:37 UTC, John Colvin wrote:
On Monday, 28 October 2013 at 11:22:03 UTC, Jeroen Bollen wrote:
Is it possible in D to create an enum of class references?
Something around the lines of:
enum ClassReferences : Interface {
CLASS1 = &ClassOne,
CLASS2 = &ClassT
On Monday, 28 October 2013 at 11:22:03 UTC, Jeroen Bollen wrote:
Is it possible in D to create an enum of class references?
Something around the lines of:
enum ClassReferences : Interface {
CLASS1 = &ClassOne,
CLASS2 = &ClassTwo
}
You can define class references in module scope and ini
On Saturday, 26 October 2013 at 17:46:31 UTC, Ali Çehreli wrote:
The following program seg faults:
struct Point
{
double x;
double y;
}
void main()
{
Point[1] arr;
}
Any combination of float and double members exhibit the same
bug as long as the size of the struct is 16.
I vague
On Thursday, 24 October 2013 at 10:58:30 UTC, bearophile wrote:
Jonathan M Davis:
It's a compiler bug. immutable data should not be initialized
more than once.
My point was another one, regarding this refused code:
import std.algorithm: copy;
immutable int[2] data;
static this() {
[10,
On Thursday, 24 October 2013 at 07:02:25 UTC, bearophile wrote:
This shows a limitation of the D type system:
import std.algorithm: copy;
immutable int[2] data;
static this() {
foreach (i, x; [10, 20]) data[i] = x; // OK
data[] = [10, 20]; // OK
[10, 20].copy(data[]); // Error.
}
vo
On Friday, 18 October 2013 at 06:56:49 UTC, monarch_dodra wrote:
On Friday, 18 October 2013 at 06:13:38 UTC, DDD wrote:
I'm learning D. I'm curious about surprises I may get. I
typically use C++, C# and javascript
Off the top of my head, I think the biggest one is that D
doesn't offer "defaul
On Wednesday, 16 October 2013 at 17:05:25 UTC, Daniel Davidson
wrote:
The code below fails to compile due to the last line. I was
hoping casting away immutable would allow the call to foo. I
think it is not accepted because of the rval to ref issue. If
that is the case, how can foo be called by
On Monday, 14 October 2013 at 17:38:22 UTC, Ali Çehreli wrote:
On 10/14/2013 10:33 AM, Kenji Hara wrote:
> On Monday, 14 October 2013 at 14:18:10 UTC, Maxim Fomin wrote:
>> This is compilable using git head.
When I read that line ...
> Kenji Hara
... I was thinking about
On Monday, 14 October 2013 at 10:45:26 UTC, Maurice wrote:
On Monday, 14 October 2013 at 09:32:15 UTC, Maxim Fomin wrote:
On Monday, 14 October 2013 at 09:17:12 UTC, John Colvin wrote:
Everything is working fine except for the error on [2] when
xxx == true, which I think is a bug.
minimised
On Monday, 14 October 2013 at 11:35:32 UTC, Jack Applegame wrote:
Why this doesn't compile?
http://dpaste.dzfl.pl/21ef5b04
class Foo {}
struct Bar1 {
const(Foo[]) member;
}
struct Bar2 {
const Foo member;
}
void main() {
const Bar1 bar1;
const Bar2
On Monday, 14 October 2013 at 13:56:58 UTC, Benjamin Thaut wrote:
Am 14.10.2013 13:54, schrieb Dicebot:
On Monday, 14 October 2013 at 11:45:30 UTC, Jack Applegame
wrote:
On Monday, 14 October 2013 at 11:38:23 UTC, Benjamin Thaut
wrote:
The line "Bar2 b2 = bar2;" would remove const from "member
On Monday, 14 October 2013 at 09:17:12 UTC, John Colvin wrote:
Everything is working fine except for the error on [2] when xxx
== true, which I think is a bug.
minimised test:
struct A
{
void opAssign(A a) {}
}
struct B {
A a;
alias a this;
}
void main() {
A a
On Saturday, 21 September 2013 at 17:03:14 UTC, Brad Roberts
wrote:
On 9/21/13 9:01 AM, Maxim Fomin wrote:
On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote:
I tried to used Valgrind (Linux) and Dr Memory (Windows)
without success to find a big leak I have
in my application.
But
On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote:
I tried to used Valgrind (Linux) and Dr Memory (Windows)
without success to find a big leak I have in my application.
But both tools can't launch my application without make it
crash.
Is application crashing without these tools? P
On Saturday, 21 September 2013 at 11:35:11 UTC, bearophile wrote:
init is part of a type and you can't change it.
Bye,
bearophile
Well, D wouldn't be D, if it did not allow something like this
for aggregate types:
import core.stdc.string, std.stdio;
pure hack(T)(T value) if (is(T == class
On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote:
I want to know if a variable has changed .init, but I don't
know if it's possible if the .init value is the same. Does
anyone have a solution for this?
int a;
int b = 0;
pragma(msg, a.init); // 0
pragma(msg, b.ini
On Wednesday, 18 September 2013 at 14:23:25 UTC, Namespace wrote:
Should I open an enhancement report?
Of course you are always free to open enhancement reports.
On Wednesday, 18 September 2013 at 13:23:10 UTC, Namespace wrote:
Code:
const { /// [1]
int a = 3;
}
void main()
{
const { /// [2]
int b = 4;
}
}
Why is [1] allowed, but not [2]?
Citing grammar:
FunctionBody:
BlockStatement
BodyStatem
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?
[...]
Th
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 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 Friday, 13 September 2013 at 15:24:17 UTC, Temtaime wrote:
Hello for all !
I need to call all objects destructors in one place.
It's guaranted, that there is no objects instances.
I tried use GC.collect but it's produces strange results.
import std.stdio;
import core.memory;
class A {
On Thursday, 12 September 2013 at 11:29:22 UTC, Jacob Carlborg
wrote:
On 2013-09-12 11:28, Namespace wrote:
But if I try to write 'override' before [1], I get this error
message:
Error: function T4._apply cannot override a non-virtual
function
This seems inconsistent. I really overwrite the
On Monday, 9 September 2013 at 17:07:59 UTC, Gyron wrote:
Hey there, I've experimented a little with UFCS today and ran
into a problem.
My first question, which is kinda off-topic:
Why does D use the int type if you give it a number started
with 0x(hex), shouldn't it use uint for that ?
It i
On Monday, 9 September 2013 at 08:06:17 UTC, MGW wrote:
I am D since the spring. Without a simple GUI to work hard. I
tried to deal with QtD quick disconnects, but I failed. I had
to develop its small and very simple library to work with Qt.
The working title of QtE. Works in Windows 32 and Lin
On Sunday, 11 August 2013 at 16:36:53 UTC, Adam D. Ruppe wrote:
On Sunday, 11 August 2013 at 04:25:21 UTC, JS wrote:
Given an object, is there a built in way to get the size of
the class the object represents?
try this:
Object obj = new Whatever();
auto size = typeid(obj).init.length;
Yes,
On Sunday, 11 August 2013 at 16:16:26 UTC, bearophile wrote:
Maxim Fomin:
GC.sizeOf seems to return size of allocated page which is
bigger than needed (for ex. it returns 16 for a new int which
is 4).
The object instance contains a pointer to the virtual table, so
there's a way to
On Sunday, 11 August 2013 at 15:28:44 UTC, JS wrote:
On Sunday, 11 August 2013 at 13:40:41 UTC, Timon Gehr wrote:
On 08/11/2013 06:25 AM, JS wrote:
Given an object, is there a built in way to get the size of
the class
the object represents?
Yes.
Troll.
I guess he does not answer to the q
On Thursday, 8 August 2013 at 23:19:49 UTC, bearophile wrote:
Ali Çehreli:
More than that. :) enums are manifest constants.
Imagine that enum as being pasted into source code as is. This
used to have surprising effects for AAs, as an enum AA would
be instantiated from scratch everywhere that
On Monday, 29 July 2013 at 21:37:30 UTC, bearophile wrote:
Temtaime:
Why i cannot declare reference in D ?
I don't know the reasons. But maybe you can create a little
struct with just a pointer inside and an alias this to a member
function that returns a ref.
Bye,
bearophile
It doesn't
On Monday, 22 July 2013 at 21:08:48 UTC, bearophile wrote:
So the standard idiom to use foreach on interval needs to be:
foreach (immutable i; 0 .. 10) { ... }
Bye,
bearophile
This comes with another issue embedded here
http://forum.dlang.org/thread/felqszcrbvtrepjtf...@forum.dlang.org
On Monday, 22 July 2013 at 15:51:45 UTC, monarch_dodra wrote:
So... you are saying that if the grammar allows it, then the
behavior is specified?
You may argue that although grammar does allows it, the feature
is semantically not defined. However here it is known what "ref
int i" means, to
On Monday, 22 July 2013 at 15:04:25 UTC, monarch_dodra wrote:
On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
On 7/22/13, JS wrote:
foreach doesn't allow you to modify the index to skip over
elements.
It does:
-
import std.stdio;
void main()
{
int[] x = [1, 2, 3, 4,
On Wednesday, 17 July 2013 at 15:26:19 UTC, John Colvin wrote:
I think I can speak quite safely for the majority of the
community when I say that you are only welcome here if you can
keep your aggressive and disrespectful comments to yourself.
I think you cannot, as nobody provided you such ri
On Sunday, 14 July 2013 at 13:38:41 UTC, Dicebot wrote:
On Sunday, 14 July 2013 at 12:33:07 UTC, JS wrote:
I would like to do something like
...
Looks like a grammar issue. UDA's are supposed to be attached
to any symbol declaration as far as I understand, which enum
members definitely are.
On Thursday, 11 July 2013 at 20:15:52 UTC, Namespace wrote:
The whole situation looks strange. If you can change both
files, than it is unclear what made you to write such
inconsistent code. If you can change only one of them, then it
should be adjusted to another (meaning importing external fi
On Thursday, 11 July 2013 at 18:22:11 UTC, Namespace wrote:
I have a style question, because a friend of mine has a similar
problem currently and I have no good advice for him.
Let's assume we have this classes:
The whole situation looks strange. If you can change both files,
than it is uncl
On Thursday, 11 July 2013 at 18:03:14 UTC, bearophile wrote:
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static,
Yet, in the code I used to initialize y in the normal
constructor of Foo. If now I tag y as static, that's not
possible any more (Error: can
On Thursday, 11 July 2013 at 17:59:22 UTC, bearophile wrote:
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static, but now it is per instance data which requires context
pointer which is deduced to be impure - that why compilation
fails (try placing static
On Thursday, 11 July 2013 at 17:07:18 UTC, Ali Çehreli wrote:
On 07/11/2013 12:23 AM, Jacob Carlborg wrote:
> On 2013-07-10 20:22, Ali Çehreli wrote:
>
>> And to be pedantic, length comes first:
>>
>> struct Array (T)
>> {
>> size_t length;
>> T* ptr;
>> }
>
> I thought "ptr" came firs
On Thursday, 11 July 2013 at 15:25:10 UTC, bearophile wrote:
This used to compile (probably dmd 2.060):
struct Foo {
immutable int y;
void bar(TF)(TF f) pure {
f(1);
}
void spam() pure {
bar((int x) => y);
}
}
void main() {}
But now it gives:
test.d(4): Er
On Thursday, 11 July 2013 at 12:03:10 UTC, Jakob Ovrum wrote:
However, in my opinion, it's a bug that you're allowed to
declare a function template (when using the shortcut syntax)
without defining it, whether in an interface or not. This is a
rather natural bug though, due to the nature of fun
On Thursday, 11 July 2013 at 07:13:50 UTC, Jacob Carlborg wrote:
On 2013-07-11 04:59, Maxim Fomin wrote:
To be pedantic dynamic arrays are implemented in D simply as
struct Array
{
size_t length;
void* ptr;
}
and there is no type parametrization since such arrays
handling is
opaque
On Wednesday, 10 July 2013 at 18:22:24 UTC, Ali Çehreli wrote:
And to be pedantic, length comes first:
struct Array (T)
{
size_t length;
T* ptr;
}
Which is actually property-like because assigning to length
does pretty complex stuff. So the member cannot be named as
'length':
struct
On Thursday, 4 July 2013 at 12:02:16 UTC, monarch_dodra wrote:
This is a pretty stupid question, but how would you allocate an
"int[]" on the heap? I'm not talking about the array, but the
actual slice object. EG:
int[]* pSlice = new int[];
//Error: new can only create structs,
//dynamic array
1 - 100 of 264 matches
Mail list logo