import std.format;
template Bootle(alias Beer = 0)
{
static if(Beer < 99)
enum Bootle = Bootle!(Beer + 1);
else
enum Bootle = Beer;
pragma(msg,
format!"%d bottles of beer on the wall, %d bottles of beer.
Take one down, pass it around, %d bottles of beer on the wall."
On Wednesday, 10 October 2018 at 16:15:56 UTC, Jabari Zakiya
wrote:
[...]
Looking forward to this :)
On Friday, 7 September 2018 at 16:20:29 UTC, H. S. Teoh wrote:
Yeah, I don't remember that either! Was this a recent
addition? Or is it an accidental feature (aka bug)? :-P
If it is a bug, please keep it ;)
On Friday, 7 September 2018 at 08:26:11 UTC, Kagamin wrote:
On Thursday, 6 September 2018 at 17:09:34 UTC, SrMordred wrote:
void foo(string s) {}
foo("this");
won't compile, since it won't make a String out of that
immutable(char)[] literal without an explicit initialization
of some sort.
On Thursday, 6 September 2018 at 16:50:01 UTC, Adam D. Ruppe
wrote:
this(object.string x) {}
Yep, this works.
which will work - immutable(char)[] is what object.string
actually is (and the compiler will often use that -
immutable(char)[], the proper name - and string, the
user-friendly name,
I'm most of the time exploring the betterC lands
and was thinking about custom strings, and how to convert D into
D-betterC
hmm I wonder...
struct String{}
alias string = String;
string x = "test";
//cannot implicitly convert expression "test" of type string to
String
ok then...
struct S
On Wednesday, 5 September 2018 at 01:58:50 UTC, Jonathan M Davis
wrote:
On Tuesday, September 4, 2018 7:18:17 PM MDT James Blachly via
Digitalmars-d wrote:
[...]
This is part of why it's sometimes been discussed that we need
a way to indicate which dub packages are currently maintained
and w
On Tuesday, 10 July 2018 at 19:14:26 UTC, Gary Willoughby wrote:
Looking at the page on -betterC it says that struct destructors
are not available.
See point 11:
https://dlang.org/spec/betterc.html#consequences
This doesn't seem to be true as I'm using them with no problem.
Yep, the docs are
On Thursday, 5 July 2018 at 20:29:02 UTC, Steven Schveighoffer
wrote:
On 7/5/18 4:27 PM, Steven Schveighoffer wrote:
template BetterSelect(bool cond, alias temp1, alias temp2,
Args...)
{
import std.meta : Instantiate;
static if(cond)
alias BetterSelect = Instantiate!(temp1, Args)
alias U = Select!( isPointer!T, PointerTarget!T, T );
This don´t compile if T are not a pointer;
so you have to do this:
static if( isPointer!T )
alias U = PointerTarget!T;
else
alias U = T;
Shouldnt the 'correct' way of Select to work is ignoring the
choice that was not taken?
I lo
and non-template-only Phobos.
unless they are using betterC (undefined reference to
'_d_arraycopy')?
Are you sure about this?
//flags: -betterC -noboundscheck
extern(C):
void main()
{
import core.stdc.stdlib;
int[] x = ( cast(int*) malloc( int.sizeof * 10 ) )[0 .. 10];
int[] y =
Or use C malloc.
We really should provide better tools to create arrays using C
malloc (for those who want them). Like a betterC toolkit.
-Steve
Indeed, i´m creating my own "toolkit" for betterC stuff like
alloc!Type(length); (much safer than malloc!) and other utilities
:)
On Tuesday, 12 June 2018 at 12:29:17 UTC, rikki cattermole wrote:
(...)
this line:
byte[] data = [0, 1];
is an dynamic array allocated with GC.
But if you declare as a static array like
byte[2] data = [0, 1];
than its not GC allocated.
We're working to get each talk into separate videos, but it may
take a while.
Thank you very much!
(for some odd reason the day 2 and 3 didn´t appear to me on
youtube when I searched)
There is some place where I can find this year conference videos
with or without slides?
Thanks!
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote:
As promised [1], I have started setting up a DIP to improve
+1, please.
I keep jumping between VSCode and SublimeText3
atm using ST3. (but they are not IDEs ;P)
From https://wiki.dlang.org/Vision/2017H2:
2. @nogc: Use of D without a garbage collector, most likely by
using reference counting and related methods Unique/Weak
references) for reclamation of resources. This task is made
challenging by the safety requirement.
Eventually it will come (I hop
I think the GC discussion think will never go away because of the
amount of c++ coders that come here.
If you want to flee from C++ you have two realistic options: Rust
and D.
When you are looking at D and comparing metaprogramming, traits,
ranges, UFCS, etc, its amazing: 'SO MUCH better tha
On Friday, 6 October 2017 at 18:42:02 UTC, H. S. Teoh wrote:
On Fri, Oct 06, 2017 at 06:09:58PM +, Ali via Digitalmars-d
wrote:
On Friday, 6 October 2017 at 17:27:03 UTC, H. S. Teoh wrote:
> On Fri, Oct 06, 2017 at 05:14:51PM +, Rion via
> Digitalmars-d wrote:
> > https://www.quora.com
On Wednesday, 4 October 2017 at 10:03:56 UTC, aberba wrote:
Upon reading this, It triggered an idea.
On Saturday, 30 September 2017 at 16:10:44 UTC, Jonathan
Marler wrote:
[...]
DIP reminds me of object destruction.
/* extracts success & message from returned type. Could be
tuple or stru
On Tuesday, 3 October 2017 at 17:15:04 UTC, Daniel Kozak wrote:
is not bad
https://godbolt.org/g/bSfubs
Thats cool, I never used copy xD.
(but you returned the .copy range, not the 'r' array ;p)
//now with ldc 1.4 and -O3 -release -boundscheck=off
foreach -> 99 lines
.filter.copy -> 3
On Tuesday, 3 October 2017 at 13:53:38 UTC, rikki cattermole
wrote:
Be warned, x86 cpu's today are not like they were 10 years ago.
A good portion of a symbol could be full of nop's and it could
end up being faster than the one without them.
Next, compare against ldc, not gdc primarily. Its be
//D compiled with gdc 5.2 -O3
auto test(int[] arr, int cmp)
{
int[] r;
foreach(v ; arr)
if(v == cmp)r~=v;
return r;
}
// 51 lines of assembly
auto test(int[] arr, int cmp)
{
return arr.filter!((v)=>v==cmp).array;
}
//1450 lines... what?
Ok let me look also at c++:
//gcc 7.
On Thursday, 17 August 2017 at 13:11:51 UTC, Enamex wrote:
On Wednesday, 16 August 2017 at 14:19:59 UTC, SrMordred wrote:
On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote:
[...]
There are two thinks of c++ that I miss a little on D:
- Structured binding
- Uniform initialization
Bu
On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote:
On Tuesday, 15 August 2017 at 20:31:50 UTC, Jonathan Marler
wrote:
Without alot of usage, it will just be an esoteric construct
that looks confusing to the average developer.
That is correct. After a while it gets tiring to see a
On Wednesday, 19 July 2017 at 14:09:32 UTC, SrMordred wrote:
On Wednesday, 19 July 2017 at 09:09:40 UTC, Stefan Koch wrote:
On Wednesday, 19 July 2017 at 07:48:28 UTC, Danni Coy wrote:
Is there a reason that the following code
struct Foo
{
this (string name)
{ do_something(name); }
On Wednesday, 19 July 2017 at 09:09:40 UTC, Stefan Koch wrote:
On Wednesday, 19 July 2017 at 07:48:28 UTC, Danni Coy wrote:
Is there a reason that the following code
struct Foo
{
this (string name)
{ do_something(name); }
~this()
{ undo_something(); }
}
Foo foo = void;
void o
28 matches
Mail list logo