On 05/30/2013 10:36 PM, Shriramana Sharma wrote:
struct pair {
It is more common to start type names with a capital letter: Pair.
double x,y ;
this () {}
That is not allowed. In D, every type has the .init property, which is
its default value.
this (double x, double y) {
On Fri, May 31, 2013 at 12:12 PM, Ali Çehreli acehr...@yahoo.com wrote:
double x,y ;
this () {}
That is not allowed. In D, every type has the .init property, which is its
default value.
Hm can you clarify that a bit? If I actually try it I get:
pair.d(14): Error: constructor
On Fri, May 31, 2013 at 12:12 PM, Ali Çehreli acehr...@yahoo.com wrote:
struct Pair {
double x, y;
}
void main()
{
auto p0 = Pair();
auto p1 = Pair(1.5);// only p1.y is 0
Wouldn't p1.y actually be NaN and not 0?
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
On Thursday, 30 May 2013 at 20:49:53 UTC, Steven Schveighoffer
wrote:
It's actually 4. separate compilation model.
If you are building a module, and it imports a d interface file
which has no function body, there is no conceivable way to tell
what the attributes should be.
For anonymous
Shriramana Sharma:
Wouldn't p1.y actually be NaN and not 0?
Right. You can verify it with a writeln.
Bye,
bearophile
On Fri, 31 May 2013 02:41:14 +0100, Shriramana Sharma samj...@gmail.com
wrote:
Thanks to all who replied.
On Thu, May 30, 2013 at 10:18 PM, bearophile bearophileh...@lycos.com
wrote:
But Walter refused them time ago on the basis that no one uses them in
C++.
So you can ask for them in
On Thursday, 30 May 2013 at 16:48:33 UTC, bearophile wrote:
Shriramana Sharma:
Hello. I have always loved the readability of C++'s
and/or/not/xor
word-like logical operators but It doesn't seem to be
available in D.
and/or/not are less visually noisy, they look better than the
ugly /||/!
On 05/30/2013 06:45 PM, bearophile wrote:
...
If you have to store many reals, they require more memory than doubles
(how much is relative to the operating system). Regarding speed in
theory double and real should give the same, ...
If double uses xmm registers and real uses the fpu registers
On Fri, May 31, 2013 at 4:31 PM, Timon Gehr timon.g...@gmx.ch wrote:
If double uses xmm registers and real uses the fpu registers (as is standard
on x64), then double multiplication has twice the throughput of real
multiplication on recent intel microarchitectures.
Hi can you clarify that?
Hello. How do I make a library from D? I see the dmd --help output
give a -lib option but am not sure how to actually use it. Can I
produce a library and then just import it by its name? (This is an
offshoot of my previous query about the proprietary lib thing.)
And given that
Now I'm *not* going to write closed source programs in D [;-)], but am
curious -- in C++ we have header files which a developer can
confidently distribute along with the compiled libraries, and the
actual source of the libraries (the *.cpp files) remains with the
developer. In D, (obviously I'm a
On Fri, 31 May 2013 12:25:48 +0100, Shriramana Sharma samj...@gmail.com
wrote:
Now I'm *not* going to write closed source programs in D [;-)], but am
curious -- in C++ we have header files which a developer can
confidently distribute along with the compiled libraries, and the
actual source of
On Fri, 31 May 2013 12:26:54 +0100, Shriramana Sharma samj...@gmail.com
wrote:
Hello. How do I make a library from D? I see the dmd --help output
give a -lib option but am not sure how to actually use it. Can I
produce a library and then just import it by its name? (This is an
offshoot of my
I thougth that in dmd 2.063 alias this : foo; would be allowed.
That was what the preview of dmd 2.063 said:
http://dlang.org/changelog.html#new2_062
Why wasn't it implemented?
Regan Heath:
I find them ugly and less clear - because I can glance at words
symbols and immediately see the operator, faster than with
words and symbols.
Finding a short, common and easy to write English word ugly is
quite strange, especially for a person that seems able to write
in
On Fri, May 31, 2013 at 4:12 PM, Minas Mina
minas_mina1...@hotmail.co.uk wrote:
They are more noisy for non-English talking persons.
Um and the rest of the D keywords are in what language?!
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
What's the reason that the string literal is a dynamic array, not
a static?
So sometimes it is not possible to get string length compile time:
void foo(T: E[N], E, size_t N)(auto ref T data) {
pragma(msg, static);
pragma(msg, data.length);
}
void foo(T: E[], E)(auto ref T data) {
On Friday, 31 May 2013 at 10:21:19 UTC, Regan Heath wrote:
Until this thread I didn't even know they existed..
Same.
I use them every day in python, but I had no idea they were in C++
Tbh they annoy me in python, although that's just my C background
showing.
Hi all,
Not sure if this is a bug so thought I'd post here.
It is very common to use a function template without the call
() expecting that it will be called. However with the latest
compilers hibernated only compiles when one leaves out the
-property dmd command line option.
The call:
On 05/27/2013 02:08 PM, Joseph Rushton Wakeling wrote:
On 05/26/2013 05:59 PM, Ali Çehreli wrote:
On 05/26/2013 05:38 AM, Simen Kjaeraas wrote:
Tuple!(size_t, size_t)[][] data = createData();
immutable dataImm = assumeUnique(data);
data = null; // Simply to ensure no mutable
On Friday, May 31, 2013 15:10:01 Shriramana Sharma wrote:
On Fri, May 31, 2013 at 12:12 PM, Ali Çehreli acehr...@yahoo.com wrote:
Consider a function that operates on a pair:
double abs2 ( pair a ) { return a.x * a.x + a.y * a.y ; }
In C++ the function signature would be: double abs2 (
On 05/31/2013 07:32 AM, rmc wrote:
It is very common to use a function template without the call ()
expecting that it will be called.
Non-templated functions too.
However with the latest compilers
hibernated only compiles when one leaves out the -property dmd command
line option.
I think
Jack Applegame:
What's the reason that the string literal is a dynamic array,
not a static?
Originally it was a fixed sized array. But in most cases you want
a dynamic array.
Rust language forces you to specify where to allocate the string
literal with a symbol before the string, as
On Friday, May 31, 2013 13:06:13 Regan Heath wrote:
.di files are .d files without the function bodies etc. There are issues
with templates and auto, but we will eventually have nice solutions for
those.
The only problem with auto is that the type can't be inferred without the
function body.
On Friday, May 31, 2013 16:20:44 Jack Applegame wrote:
What's the reason that the string literal is a dynamic array, not
a static?
Would you really want to end up with a copy of a string literal every time you
used it? The fact that they're immutable and can be passed around without ever
On Friday, May 31, 2013 08:27:19 Ali Çehreli wrote:
I think it is the same issue with non-templated functions. The best
thing to do is to forget about the -property switch. I did about a year
ago and never looked back. :)
Given the most recent discussions on @property, I think that it's a
On 05/31/2013 02:40 AM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 12:12 PM, Ali Çehreli acehr...@yahoo.com wrote:
double x,y ;
this () {}
That is not allowed. In D, every type has the .init property, which
is its
default value.
Hm can you clarify that a bit? If I
On 05/31/2013 05:12 AM, Namespace wrote:
I thougth that in dmd 2.063 alias this : foo; would be allowed.
You mean the equal sign?
alias this = foo;
That was implemented in 2.061 by accident likely due to a confusion
whether the new alias syntax should apply to 'alias this' as well.
On 05/31/2013 04:28 AM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 4:31 PM, Timon Gehr timon.g...@gmx.ch wrote:
If double uses xmm registers and real uses the fpu registers (as is
standard
on x64), then double multiplication has twice the throughput of real
multiplication on recent
The D Programming Language (TDPL) p.178 asserts the following.
The objects themselves stay put, that is their locations in
memory never change after creation.
I take this to mean that the D garbage collector doesn't move
live objects and adjust all references to them the way that some
No, I meant the colon.
alias this : foo;
On Friday, 31 May 2013 at 15:35:51 UTC, Jonathan M Davis wrote:
The fact
that it's a string is irrelevant, and making it a static array
woludn't help
any. If data were a template argument, it would work, but it's
a funciton
argument, so it won't.
If to pass reference to static array as
On 2013-05-31, 14:12, Namespace wrote:
I thougth that in dmd 2.063 alias this : foo; would be allowed.
That was what the preview of dmd 2.063 said:
http://dlang.org/changelog.html#new2_062
Why wasn't it implemented?
Probably not enough time. I've not read anything about it no
longer being
On 2013-05-31, 18:31, Carl Sturtivant wrote:
The D Programming Language (TDPL) p.178 asserts the following.
The objects themselves stay put, that is their locations in memory
never change after creation.
I take this to mean that the D garbage collector doesn't move live
objects and
import std.stdio ;
void foo ( int[] array ) {
foreach ( i ; array ) { writeln ( i ) ; }
}
void main () {
foo ( [ 1, 2, 3 ] ) ;
}
On both DMD 2.062 and 2.063 this compiles OK but causes a segfault.
I'm running Kubuntu Raring 64-bit. Any hints?
--
Shriramana Sharma ஶ்ரீரமணஶர்மா
Carl Sturtivant:
Does D guarantee this?
In theory D is designed to allow a moving garbage collector. The
current GC doesn't move objects.
Bye,
bearophile
Am Fri, 31 May 2013 10:59:09 +0700
schrieb Alexandr Druzhinin drug2...@bk.ru:
You mean I didn't initialize c?
It was a wild guess, that you might come from C++ and write
SomeClass c;
which would be an instance of that class in C++, but a null
reference in D. As you said you only get the
Thanks to all who explained the various issues. Some more questions:
On Fri, May 31, 2013 at 9:28 PM, Ali Çehreli acehr...@yahoo.com wrote:
What the error message is saying is that you can declare it just to disable
its use:
struct Pair {
double x = 10.75;
double y = 20.25;
//
On Friday, 31 May 2013 at 17:14:46 UTC, Shriramana Sharma wrote:
import std.stdio ;
void foo ( int[] array ) {
foreach ( i ; array ) { writeln ( i ) ; }
}
void main () {
foo ( [ 1, 2, 3 ] ) ;
}
On both DMD 2.062 and 2.063 this compiles OK but causes a
segfault.
I'm running
On 05/31/2013 10:49 AM, Shriramana Sharma wrote:
struct Pair {
double x = 10.75;
double y = 20.25;
// Default constructor disabled
@disable this();
// Users must use another constructor:
this(double x, double y) { this.x = x; this.y = y; }
}
As you see,
On Friday, 31 May 2013 at 18:22:44 UTC, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 11:46 PM, John Colvin
john.loughran.col...@gmail.com wrote:
Can't reproduce this. Any chance of a stacktrace and/or
disassembly?
Please give instructions as to how I can get either of those
two for
On Friday, 31 May 2013 at 17:14:52 UTC, Jonathan M Davis wrote:
On Friday, May 31, 2013 18:31:38 Carl Sturtivant wrote:
The D Programming Language (TDPL) p.178 asserts the
following.
The objects themselves stay put, that is their locations in
memory never change after creation.
I take this
On Friday, 31 May 2013 at 16:17:28 UTC, Ali Çehreli wrote:
On 05/31/2013 04:28 AM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 4:31 PM, Timon Gehr
timon.g...@gmx.ch wrote:
If double uses xmm registers and real uses the fpu registers
(as is standard
on x64), then double multiplication
We really don't want D to become a TMTOWTDI language. Ideally
there should be 1 right way and no alternatives. That way,
anyone who knows D will have a greater chance of knowing what
any given code sample does, and not have to look up alternate
syntax etc.
R
Up to a point I'd certainly
Hello!
I'm trying to use following code:
==
//...
class A
{
private
{
int m_someVar = 10;
}
public
{
this()
{
}
}
}
int main(string[] args)
{
On Friday, 31 May 2013 at 17:50:33 UTC, Shriramana Sharma wrote:
Sorry but I still don't get it -- if a default constructor is
disallowed for struct-s by the language itself, why should I
have to
*tell* the compiler to disable it?
The compiler always provides a default constructor (maybe not
On Friday, 31 May 2013 at 21:01:49 UTC, Andrey wrote:
Hello!
I'm trying to use following code:
==
//...
class A
{
private
{
int m_someVar = 10;
}
public
{
this()
{
On 05/31/2013 09:08 PM, John Colvin wrote:
On Friday, 31 May 2013 at 16:17:28 UTC, Ali Çehreli wrote:
On 05/31/2013 04:28 AM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 4:31 PM, Timon Gehr
timon.g...@gmx.ch wrote:
If double uses xmm registers and real uses the fpu registers
(as is
On 05/31/2013 01:28 PM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 4:31 PM, Timon Gehr timon.g...@gmx.ch wrote:
If double uses xmm registers and real uses the fpu registers (as is standard
on x64), then double multiplication has twice the throughput of real
multiplication on recent intel
On Friday, May 31, 2013 23:25:02 Jesse Phillips wrote:
On Friday, 31 May 2013 at 17:50:33 UTC, Shriramana Sharma wrote:
Sorry but I still don't get it -- if a default constructor is
disallowed for struct-s by the language itself, why should I
have to
*tell* the compiler to disable it?
On Sat, Jun 1, 2013 at 1:13 AM, Jonathan M Davis jmdavisp...@gmx.com wrote:
Certainly,
for anything that's small enough to fit in a register, it's likely to be
faster
to pass by value.
So pardon my ignorance, but a pair which only contains two doubles --
it would fit in a CPU register? How
On Fri, May 31, 2013 at 8:55 PM, Jonathan M Davis jmdavisp...@gmx.com wrote:
In D, const ref does not accept rvalues (unlike C++'s const ).
So what is the syntax that accepts rvalues and yet does not make a
copy of the input object? I mean, as Ali says OK profiling is
preferable to find out
On Sat, Jun 1, 2013 at 12:07 AM, John Colvin
john.loughran.col...@gmail.com wrote:
given a program named test in the current directory
gdb ./test
run #will segfault
bt full
and copy the output.
Did it (after installing libc6-dbg just in case) but it doesn't seem
to be very
On Sat, Jun 1, 2013 at 5:11 AM, Shriramana Sharma samj...@gmail.com wrote:
So what is the syntax that accepts rvalues and yet does not make a
copy of the input object? I mean, as Ali says OK profiling is
preferable to find out where exactly passing by value is more
efficient than passing by
On Friday, 31 May 2013 at 17:14:46 UTC, Shriramana Sharma wrote:
import std.stdio ;
void foo ( int[] array ) {
foreach ( i ; array ) { writeln ( i ) ; }
}
void main () {
foo ( [ 1, 2, 3 ] ) ;
}
On both DMD 2.062 and 2.063 this compiles OK but causes a
segfault.
I'm running
On Friday, May 31, 2013 23:26:19 Anthony Goins wrote:
To create a shared object you need shared this ctor.
immutable this() for immutable,
and const this() for const.
Check out the change log. #2 on the list.
Either that or you create it as thread-local and cast to shared.
- Jonathan M
Not sure this is the right forum but here we go:
When using unix command 'script' to log the terminal input/output commands,
it includes special ansi control escape characters.
I'd like to filter out the generated script file from those character
sequences, so that it preserves the content
On Sat, Jun 1, 2013 at 6:02 AM, Anthony Goins neonto...@gmail.com wrote:
Works for me ubuntu 64.
Do you have both versions installed?
Of course not. The later install from the distributed DEB (from
dlang.org) overwrites the earlier one by apt install.
Would it compile if you used the wrong
On 05/31/2013 04:41 PM, Shriramana Sharma wrote:
On Fri, May 31, 2013 at 8:55 PM, Jonathan M Davis
jmdavisp...@gmx.com wrote:
In D, const ref does not accept rvalues (unlike C++'s const ).
So what is the syntax that accepts rvalues and yet does not make a
copy of the input object?
I
On Saturday, June 01, 2013 05:11:44 Shriramana Sharma wrote:
On Fri, May 31, 2013 at 8:55 PM, Jonathan M Davis jmdavisp...@gmx.com
wrote:
In D, const ref does not accept rvalues (unlike C++'s const ).
So what is the syntax that accepts rvalues and yet does not make a
copy of the input
On Saturday, June 01, 2013 04:39:07 Shriramana Sharma wrote:
On Sat, Jun 1, 2013 at 1:13 AM, Jonathan M Davis jmdavisp...@gmx.com
wrote:
Certainly,
for anything that's small enough to fit in a register, it's likely to be
faster to pass by value.
So pardon my ignorance, but a pair which
On Saturday, June 01, 2013 05:15:22 Shriramana Sharma wrote:
On Sat, Jun 1, 2013 at 5:11 AM, Shriramana Sharma samj...@gmail.com wrote:
So what is the syntax that accepts rvalues and yet does not make a
copy of the input object? I mean, as Ali says OK profiling is
preferable to find out
On 05/31/2013 04:45 PM, Shriramana Sharma wrote:
And again, sorry if I'm being dumb, but is the proposed inout syntax
intended to fix this problem or some other problem?
Think of 'inout' as a placeholder for one of the following three:
- const
- immutable
- (no const, nor immutable)
inout
On Saturday, 1 June 2013 at 01:08:46 UTC, Timothee Cour wrote:
removes escape codes for coloring, etc.
Getting all these is a very difficult task because the escape
sequences aren't all well defined.
But, you should get pretty good results by just filtering out
anything that starts with
On Saturday, 1 June 2013 at 01:08:46 UTC, Timothee Cour wrote:
string; also the behavior of backspace needs to be emulated.
oops I missed this on my fires readthrough. But if instead of
if(c == 8) continue, you did if(c == 8){ outputString =
outputString[0 .. $-1]; continue;} that should be
Thanks Jonathan and Ali for all those clarifications.
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
66 matches
Mail list logo