On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote:
Why doesn't the compiler produces an error?
-
import std.stdio;
void main() {
writeln({});
}
-
http://ideone.com/qTZCAd
Somehow reminds me of this lambda:
On Friday, 15 May 2015 at 03:33:47 UTC, TJB wrote:
I have built a toy dynamic shared library on Mac OS X (in C),
and I have verified that it works from C. Now I would like to
call it from D. So I have created the following interface file:
$ cat hello.di
extern (C):
void printHelloWorld();
On Friday, 15 May 2015 at 06:11:41 UTC, Charles Hixson wrote:
On 05/14/2015 06:38 PM, Adam D. Ruppe via Digitalmars-d-learn
wrote:
On Friday, 15 May 2015 at 01:03:32 UTC, Charles Hixson wrote:
Yes, that looks as if it would do the job, but what are its
advantages over a simple struct?
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
What I'm doing wrong?
Try using class instead of struct.
Last time I played with std.concurrency it used Variants to store
the messages, so when something bigger than a little
On Friday, 15 May 2015 at 07:51:29 UTC, thedeemon wrote:
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
What I'm doing wrong?
Try using class instead of struct.
Last time I played with std.concurrency it used Variants to
Thank you for the explanation
On 05/14/2015 06:38 PM, Adam D. Ruppe via Digitalmars-d-learn wrote:
On Friday, 15 May 2015 at 01:03:32 UTC, Charles Hixson wrote:
Yes, that looks as if it would do the job, but what are its
advantages over a simple struct?
None really, except perhaps automatic forwarding of operators which
I recall having seen an example of using some D magic (via mixin
perhaps?) to realize tuple destructuring in assignments like
magic(first, _, second) = expression.findSplit(separator);
somewhere. But I can't seem to find it right now.
References anyone?
BTW :I'm aware of Kenjis PR, which
import std.algorithm;
template magicassign(A...) {
void magicassign(B)(B b) @property {
foreach(I, ref a; A)
static if (!is(typeof(A[I]):typeof(null)))
a = b[I];
}
}
template let(string D) {
mixin({
enum sdsl =
On Friday, 15 May 2015 at 11:04:24 UTC, Per Nordlöw wrote:
I'm guessing the closest thing we can get in current D version
is something like
let(q{first, _, second},
expression.findSplit(separator));
right?
Correction: I believe it must look like
let!q{first, _,
On Friday, 15 May 2015 at 09:20:32 UTC, Gary Willoughby wrote:
On Friday, 15 May 2015 at 07:51:29 UTC, thedeemon wrote:
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
What I'm doing wrong?
Try using class instead of
On Friday, 15 May 2015 at 10:23:24 UTC, Per Nordlöw wrote:
I recall having seen an example of using some D magic (via
mixin perhaps?) to realize tuple destructuring in assignments
like
magic(first, _, second) = expression.findSplit(separator);
somewhere. But I can't seem to find it right
On Friday, 15 May 2015 at 10:23:24 UTC, Per Nordlöw wrote:
I recall having seen an example of using some D magic (via
mixin perhaps?) to realize tuple destructuring in assignments
like
magic(first, _, second) = expression.findSplit(separator);
I found it:
Working my way through Ali Çehreli's rather amazing e-book, I've
hit a snag where some code I've written is pretty crashy. I
consistently get Segmentation fault: 11 (dmd 2.067.1, OSX).
I can't figure out where things are going wrong, because any
attempt I make to debug via extra print
On Friday, 15 May 2015 at 11:08:06 UTC, Rob Pieké wrote:
Working my way through Ali Çehreli's rather amazing e-book,
I've hit a snag where some code I've written is pretty crashy.
I consistently get Segmentation fault: 11 (dmd 2.067.1, OSX).
I can't figure out where things are going wrong,
On Friday, 15 May 2015 at 10:46:32 UTC, Per Nordlöw wrote:
Can this be solved with a mixin somehow?
To clarify, I want to be able to write
let(first, _, second) = expression.findSplit(separator);
without having to first declare `first`, `_` and `second`.
I'm guessing the closest thing
On Friday, 15 May 2015 at 11:44:32 UTC, John Colvin wrote:
On Friday, 15 May 2015 at 11:08:06 UTC, Rob Pieké wrote:
Working my way through Ali Çehreli's rather amazing e-book,
I've hit a snag where some code I've written is pretty crashy.
I consistently get Segmentation fault: 11 (dmd 2.067.1,
https://issues.dlang.org/show_bug.cgi?id=14587
And confirmed that ldc2 seems to work, thanks again :)
On Friday, 15 May 2015 at 12:22:55 UTC, Artur Skawina wrote:
template let(string D) {
mixin({
enum sdsl = D.findSplit(=);
mixin(`struct S { int `~sdsl[0]~`; }`);
string code = `auto v = ` ~ sdsl[2] ~ `;`;
foreach (I, _; typeof(S.tupleof))
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
This code works compiled by DMD v2.066.1 and LDC2 (0.15.1)
based on DMD v2.066.1 and LLVM 3.5.0.
$ ./z
TUQLUE
42
11
Compiled by DMD v2.067.1 the program crashes:
$ ./aa
TUQLUE
On Friday, 15 May 2015 at 12:22:55 UTC, Artur Skawina wrote:
import std.algorithm;
template let(string D) {
mixin({
enum sdsl = D.findSplit(=);
mixin(`struct S { int `~sdsl[0]~`; }`);
string code = `auto v = ` ~ sdsl[2] ~ `;`;
foreach (I, _;
On Thursday, 14 May 2015 at 17:12:07 UTC, John Colvin wrote:
Would it be OK if I showed some parts of this code as examples
in my DConf talk in 2 weeks?
Sure!!!
On Friday, 15 May 2015 at 13:40:01 UTC, Per Nordlöw wrote:
I added support for auto, const and immutable declarations at
https://github.com/nordlow/justd/blob/master/ties.d#L96
And support for ignoring `_` as a variable as:
import std.algorithm.searching: findSplit;
mixin let!q{ c,
Thanks John, I'll log the issue and start brewing ldc. I'm
happy that I wasn't doing something obviously stupid with my
code (again, in terms of crashing, not design).
And also thanks for the with tip!
- Rob
On 5/14/15 11:22 PM, rcorre wrote:
On Thursday, 14 May 2015 at 18:44:58 UTC, Steven Schveighoffer wrote:
It depends on the guts of MyContainer.Range.
I'm assuming MyContainer.Range has SOME sort of references (i.e.
pointers) to the data in the container, so why not just have:
bool empty() {
On 5/15/15 7:08 AM, Rob =?UTF-8?B?UGlla8OpIg==?= robpi...@gmail.com
wrote:
Working my way through Ali Çehreli's rather amazing e-book, I've hit a
snag where some code I've written is pretty crashy. I consistently get
Segmentation fault: 11 (dmd 2.067.1, OSX).
Using dustmite (and 2.067.0), I
What is the difference between 'const' and 'in' parameter storage
classes?
When should I use 'const' or 'in'?
The documentation says 'in' is the same as 'const scope' but I
can't write 'const scope ref' though it's legal to write 'in ref'.
Thank you
The scope storage class means you promise not to escape any
reference to the data. This isn't enforced but it is similar in
concept to Rust's borrowed pointers - it may someday be
implemented to be an error to store them in an outside variable.
Only use 'in' if you are looking at the data,
On 05/15/2015 11:31 PM, Manfred Nowak wrote:
class C{}
int main(){
void opOpAssign( string op)( C a, C b){
}
C a, b;
a+= b;
}
https://issues.dlang.org/show_bug.cgi?id=8062
On Saturday, 16 May 2015 at 02:06:45 UTC, weaselcat wrote:
very long standing compiler bug
https://issues.dlang.org/show_bug.cgi?id=3051
see also
https://issues.dlang.org/show_bug.cgi?id=5710
unsure if they're duplicate bugs, never really looked into it.
On Saturday, 16 May 2015 at 02:04:39 UTC, Vlad Levenfeld wrote:
I think this code should be allowed, but it isn't:
struct Functor (T)
{
T a;
auto ref fmap (alias f)()
{
return Functor (f(a));
On Saturday, 16 May 2015 at 02:08:09 UTC, weaselcat wrote:
On Saturday, 16 May 2015 at 02:06:45 UTC, weaselcat wrote:
very long standing compiler bug
https://issues.dlang.org/show_bug.cgi?id=3051
see also
https://issues.dlang.org/show_bug.cgi?id=5710
unsure if they're duplicate bugs, never
I think this code should be allowed, but it isn't:
struct Functor (T)
{
T a;
auto ref fmap (alias f)()
{
return Functor (f(a));
}
}
auto ref identity (T)(auto ref T a)
On Friday, May 15, 2015 21:31:35 Manfred Nowak via Digitalmars-d-learn wrote:
The following gives:
Error: 'a += b' is not a scalar, it is a C
although UFCS should engage.
-manfred
class C{}
int main(){
void opOpAssign( string op)( C a, C b){
}
C a, b;
a+= b;
}
Overloaded
Off the top of my head: does adding -L-L$(pwd) help?
This is what I get:
$ dmd main.d -L-L$(pwd) -lhello
Error: unrecognized switch '-lhello'
Sorry if this is completely elementary and I am being quite dumb.
Thanks,
TJB
On Friday, 15 May 2015 at 19:39:53 UTC, TJB wrote:
Off the top of my head: does adding -L-L$(pwd) help?
This is what I get:
$ dmd main.d -L-L$(pwd) -lhello
Error: unrecognized switch '-lhello'
Sorry if this is completely elementary and I am being quite
dumb.
Thanks,
TJB
should be
$ dmd
On 2015-05-04 18:22:17 +, Ali Çehreli said:
There are many different kinds of tuples in D, only two of which I can handle:
1) Tuple from std.typecons, which are ordinarily created at run time
2) TypeTuple from std.typetuple, which are compile-time entities
The documentation is not clear
Deprecation: super is not an lvalue
1) How to know when this will indeed be deprecated?
2) What does it mean, when `super++' is signalled as depracation, but
`super+=' is not signalled?
-manfred
On 5/15/15 12:50 PM, Manfred Nowak wrote:
Deprecation: super is not an lvalue
1) How to know when this will indeed be deprecated?
2) What does it mean, when `super++' is signalled as depracation, but
`super+=' is not signalled?
That seems like a bug.
I think super being an lvalue in this
On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer
wrote:
On 5/15/15 12:04 PM, ref2401 wrote:
What is the difference between 'const' and 'in' parameter
storage classes?
When should I use 'const' or 'in'?
The documentation says 'in' is the same as 'const scope' but I
can't
write
On Friday, 15 May 2015 at 16:08:31 UTC, Adam D. Ruppe wrote:
The scope storage class means you promise not to escape any
reference to the data. This isn't enforced but it is similar in
concept to Rust's borrowed pointers - it may someday be
implemented to be an error to store them in an
On Thursday, 14 May 2015 at 17:25:55 UTC, ponce wrote:
But then we would need a standardized name (some use close,
some use dispose, some use release)
In .net the standardized name is dispose and IDisposable
interface having the method:
Steven Schveighoffer wrote:
That seems like a bug.
https://issues.dlang.org/show_bug.cgi?id=14589
-manfred
On Friday, 15 May 2015 at 08:44:41 UTC, Ivan Kazmenko wrote:
Somehow reminds me of this lambda:
https://github.com/Hackerpilot/Idiotmatic-D/blob/master/idiotmatic.d#L127-L128
Maybe it generally blocks for initialization of variables:
thanks, that did the trick!
On Thursday, 14 May 2015 at 20:50:05 UTC, ivoras wrote:
I'm experimenting to get a feel for the language. Do you have a
suggestion about this example code: https://goo.gl/F7LCAg to
make it more D-like, idiomatic?
Quoting from the code:
for (int i = 0; i count; i++) {
foreach(i; 0 ..
On Friday, 15 May 2015 at 18:18:13 UTC, ref2401 wrote:
globalPtr = ms; // is it legal?
No, but the compiler check isn't implemented.
On 5/15/15 12:04 PM, ref2401 wrote:
What is the difference between 'const' and 'in' parameter storage classes?
When should I use 'const' or 'in'?
The documentation says 'in' is the same as 'const scope' but I can't
write 'const scope ref' though it's legal to write 'in ref'.
scope ref const
On 05/15/2015 09:45 AM, Robert M. Münch wrote:
On 2015-05-04 18:22:17 +, Ali Çehreli said:
TypeTuple is great because it enables compile-time foreach
(unfortunately, implicitly):
foreach (m; __traits(allMembers, A)) {
// This body is repeated for each member at compile
Another idiom from .net is Dispose(bool) method, called with
argument true from Dispose and with argument false from
finalizer. https://msdn.microsoft.com/en-us/library/d9yzd5cx.aspx
The following gives:
Error: 'a += b' is not a scalar, it is a C
although UFCS should engage.
-manfred
class C{}
int main(){
void opOpAssign( string op)( C a, C b){
}
C a, b;
a+= b;
}
51 matches
Mail list logo