On Saturday, 23 May 2015 at 20:25:18 UTC, Dennis Ritchie wrote:
This does not work!
enum n1 = 5;
writeln(stdin.byLine
.map!(line = line.split( ).map!(x = to!int(x)))
);
-
http://rextester.com/VGHZF81178
The code itself is ok.
That site has broken newlines. You can see here that
On Saturday, 23 May 2015 at 21:08:19 UTC, Dennis Ritchie wrote:
Perhaps that's not the site, and in Windows. That's what gives
me in CMD:
456 4 4 8 99 456
[[456, 4, 4, 8, 99, 456]13 546
std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2013):
Unexpected end of input
On Tuesday, 7 July 2015 at 19:54:19 UTC, jmh530 wrote:
I'm not sure I understand the safety of function pointers vs.
the addresses of functions. The code below illustrates the
issue.
I was under the impression that pointers are not allowed in
safe code.
No, pointers are fine. It's pointer
The following alias declaration is totally legal but actually
it's not usable
---
class Foo
{
void something(size_t param){}
}
class Bar
{
private Foo foo;
this(){foo = new Foo;}
alias somethingelse = foo.something;
}
void main(string[] args)
{
auto bar = new Bar;
On Sunday, 16 August 2015 at 23:05:42 UTC, Ali Çehreli wrote:
// Now the type of d is a template parameter
@nogc auto func(Func)(uint[] arr, Func d)
{
return arr.map!(d);
}
Huh. I think func being a template is the key here. When the
original code is put in a template, it works too (with
On Monday, 17 August 2015 at 13:13:48 UTC, anonymous wrote:
and figured out that the linker is invoked (on my machine) with
gcc a.o -o a -m64 -lcurl -L/usr/lib/x86_64-linux-gnu -Xlinker
correct (I named the example programm a.d instead of app.d):
gcc app.o -o app -m64 -lcurl
On Monday, 17 August 2015 at 10:28:33 UTC, thedeemon wrote:
Nope, it works only because r is unreferenced and gets
thrown out. Just try using r.front there, for example, and the
error returns.
You're right, it falls short.
But I think r not being referenced is not exactly it. Using front
in
On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote:
On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote:
Hovewer, dmd app.d spits a whole bunch of strange error
messages:
try dmd -lcurl app.d and see if that helps.
DMD does not accept -lcurl. From dmd --help:
On Saturday, 15 August 2015 at 19:50:56 UTC, Temtaime wrote:
There's a problem with « dst[0 .. n] = val; ».
It should be « dst[0 .. n][] = val; »
No, you don't need the `[]`.
On Sunday, 16 August 2015 at 11:25:48 UTC, Nordlöw wrote:
I tried rebuilding my knowledge graph project at
https://github.com/nordlow/justd/tree/master/knet
with DMD 2.068 and it seems like we have a regression in
std.traits: EnumMembers:
[...]
It builds without errors nor warnings on
On Sunday 23 August 2015 19:58, Doolan wrote:
You can use typeof to get the type of a range expression when
typing it out is impractical/impossible.
What if I want to save a range in a struct? Or is a range more of
a verb than a noun..?
Can still use typeof then:
struct S
{
import
On Sunday 23 August 2015 11:54, Tony wrote:
weather_report.d(32): Error: undefined identifier centerJustifier
`centerJustifier` is new in 2.068. You're probably using an older version of
D. You can replace `centerJustifier` with `center` here.
On Sunday 23 August 2015 12:17, Doolan wrote:
And the use of auto everywhere makes it really hard to tell what
types I should be using for anything. My compiler talks about
RangeT!(whatever) but you try to use RangeT!(whatever) and you
find out RangeT is private...
You can use typeof to get
I saw https://issues.dlang.org/show_bug.cgi?id=14956 .
questions:
- is std.basic_string released into the wild?
- where do I find std.basic_string?
- does std.vector exist? That would allow me to get rid of some
C++ clue code (build an C-like interface, copy data etc)...
Putting
extern(C++)
On Monday, 17 August 2015 at 16:21:16 UTC, thedeemon wrote:
On Monday, 17 August 2015 at 16:18:50 UTC, thedeemon wrote:
I've just checked with my runtime GC hook. Here the call to
func() allocates 12 bytes via gc_malloc, and it's the same for
a 4-elements array, so it's not for the array
On Thursday 20 August 2015 22:31, Unknow wrote:
I'm writed a program for calculating the e number. I can compile
the source code but when i try run the program, system gives
'program stopped working' error.
Source code;
// main.d
module main;
import std.file;
import std.conv;
On Thursday 20 August 2015 23:11, anonymous wrote:
2) *integer++ doesn't do what you think it does. The increment is done
before the dereference. You could fix this, but:
I got that one wrong. Steven Schveighoffer has it right. The pointer is
incremented after the currently pointed-to value
On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote:
void my_func(auto arr)
{
writeln(arr);
}
There are no `auto` parameters in D. You have to make it a
template explicitly:
void my_func(A)(A arr)
{
writeln(arr);
}
On Wednesday, 29 July 2015 at 21:33:16 UTC, remi thebault wrote:
Hello
I have this weird error trying to achieve something simple:
That's far from simple.
Here's a reduction:
template wl_container_of(alias member)
{
size_t get() {return member.offsetof;}
}
struct item { int link;
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote:
How would I use a C function that's returning a struct? auto
doesn't work here, and from what I can tell D can't import C
headers. (If it really can't then, that would be a very welcome
feature)
I do have the required libs but I
On Friday, 31 July 2015 at 11:09:39 UTC, anonymous wrote:
Definitely a bug. Please file an issue at
https://issues.dlang.org/.
https://issues.dlang.org/show_bug.cgi?id=14858
On Sunday, 2 August 2015 at 08:08:05 UTC, tcak wrote:
[code]
void func1(N)( const N name )
if( is(N: string) || is(N: char[]) )
{
func2( name );
}
void func2(N)( const N name )
if( is(N: string) || is(N: char[]) )
{}
void main(){
char[] blah = ['b', 'l', 'a',
On Tuesday, 28 July 2015 at 22:52:31 UTC, Binarydepth wrote:
I'm reading the reference : http://dlang.org/arrays.html
And I'm declaring two dynamic arrays as I understand. What I
had in mind was declaring a dynamic array of two elements each.
int[2][] is exactly an dynamic array of (arrays
On Tuesday, 28 July 2015 at 16:41:40 UTC, Binarydepth wrote:
It works with 2 as input but shows error when number is 3 :(
I can't reproduce that or I misunderstood something:
$ cat a.d
import std.stdio : readf, writef;
void main(){
int[2][] nam;
int num;
readf(
On Tuesday, 28 July 2015 at 16:09:46 UTC, Binarydepth wrote:
Here is what I'm trying to do :
import std.stdio : readf, writef;
void main() {
int[2][] nam;
int num;
readf( %d, num);
nam.length = num;
foreach(nim; 0..num){
readf( %d
On Wednesday, 5 August 2015 at 12:32:48 UTC, cym13 wrote:
For reference, as the diagram was unreadable, I'll describe it
here:
class Adam ;
class Eve ;
class Abel:Adam,Eve ;
class Cain:Adam,Eve ;
class David:Abel,Cain ;
This is illegal D. You must use interfaces to simulate multiple
On Wednesday, 5 August 2015 at 21:02:49 UTC, Andre Polykanine
wrote:
Hi everyone,
I'm fairly new to D and am really excited about it.
I would like to see more examples of Windows programming in D,
but the
repository indicated on the D wiki seems to be moved or deleted.
More info is here:
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote:
//Why expression 'foobar(1);' doesn't work?
void foo()(){}
void bar(int){}
alias foobar = foo;
alias foobar = bar;
void main(){
.foobar(1); //OK
foobar(1); //Error: overload alias 'foo' is not a
On Tuesday, 28 July 2015 at 21:12:13 UTC, Johan Engelen wrote:
Hi all,
I am wondering if there is any Phobos functionality for
indexing into a list using a type. What I mean is something
like:
assert( somethingie!(float, float, double, real)(1, 22, 333)
== 1 );
assert(
On Tuesday, 11 August 2015 at 19:56:02 UTC, Suliman wrote:
Date startDate = Date.fromISOExtString(2014-08-01);
[...]
Date nextday;
while (nextday currentDate)
{
nextday = startDate + 1.days;
writeln(nextday);
}
startDate
On Thursday, 6 August 2015 at 20:21:38 UTC, Carl Sturtivant wrote:
I took the example code from here,
http://dlang.org/phobos/core_thread.html#.Fiber
and wrapped the statements at the bottom inside main() and put
import core.thread and std.stdio at the top, and the compiler
gave me the
On Thursday, 6 August 2015 at 17:01:32 UTC, chris wrote:
since memorystream is deprecated how do i do something like
this with Input and Output ranges? How can i fill up an array
with ranges like you can do with streams?
Thanks.
The InputRange primitives already exist for arrays, they are
On Thursday, 13 August 2015 at 16:28:15 UTC, learn wrote:
unfortunately i can't find a complete set of windows header
files.
maybe one should add a link for those headers if they exist -
life is not linux or osx only.
https://github.com/etcimon/windows-headers
On Thursday, 13 August 2015 at 19:13:55 UTC, D_Learner wrote:
I was wondering how I could change the code below such the
`bmBc` is computed at compile time . The one below works for
runtime but it is not ideal since I need to know the `bmBc`
table at compile-time . I could appreciate advice
On Friday, 14 August 2015 at 07:04:53 UTC, BBasile wrote:
It's because of the key type (string is a library type).
This is not true. It's not because of the key type. And string is
not a library type.
On Sunday, 9 August 2015 at 20:23:00 UTC, Reflexive wrote:
I see that remove() removes the value of the element but keeps
the same size of the array, and replace the value by a new one
at the end. The method :
class sabot{
card[] sabotarray ;
(...)
card getCard(){
On Sunday, 9 August 2015 at 20:13:38 UTC, ixid wrote:
This seems like a reasonable use but errors, obviously I can do
it in many other ways:
ulong[] result = iota(1UL, 10UL).array;
Error: static assert Argument types in (ulong) are not all
convertible to size_t:
(ulong)
On Sunday, 9 August 2015 at 17:43:59 UTC, 岩倉 澪 wrote:
Afaict it is the best way to do what I'm trying to do, and
since the data is mutable and cast to immutable with
assumeUnique, casting it back to mutable shouldn't be a
problem. Technically casting away immutable might be undefined
On Saturday, 15 August 2015 at 02:21:46 UTC, D_Learner wrote:
Well, the actual error I got is : Error: memset cannot be
interpreted at compile time, because it has no available source
code . I seems to suggest I miss the actual code.
I guess I gave you a wrong impression of how pure relates
On Saturday, 15 August 2015 at 02:21:46 UTC, D_Learner wrote:
On Saturday, 15 August 2015 at 01:13:02 UTC, Adam D. Ruppe
wrote:
On Saturday, 15 August 2015 at 01:09:15 UTC, D_Learner wrote:
When writting a pure fucntion involving C non pure functions
like
memcpy() and memset()
Those
On Saturday, 15 August 2015 at 18:04:30 UTC, D_Learner wrote:
memcpy(skip[0], skip[0]+shift, (m-shift)*(int.sizeof));
memset(skip[0]+(m-shift),0, shift*(int.sizeof))
I was thinking conversion would be :-
skip[0 .. size-1] = skip[shift .. size-1 ]; //For the
memcpy();
Those
https://issues.dlang.org/show_bug.cgi?id=14920
On Monday, 27 July 2015 at 12:03:06 UTC, Vlad Leberstein wrote:
Hi! My use case requires interaction with C API which in turn
implies storing object instance reference as void *. I'm using
gdc 4.9.2 and everything worked fine with object - void * -
object conversion, but object - void * -
On Monday, 27 July 2015 at 13:11:33 UTC, anonymous wrote:
In the first example, you pass a pointer to a class instance.
You cannot get the vtbl entry for the interface like this.
Instead try to do this in 2 steps:
actually i meant you pass an untyped pointer, so when you cast as
interface
On Monday, 27 July 2015 at 16:48:00 UTC, Alex wrote:
Okay. By pure trying I found out what I did wrong:
Apparently by typing Y I entered the shift key. Could that have
been the problem?
I changed it to a small y and it at least jumped back to the
commandline instead of just being stuck.
And
On Sunday, 26 July 2015 at 11:38:31 UTC, simendsjo wrote:
Is there a reason why you would hide the fact that a function
is trusted rather than safe? Technically it doesn't matter,
right? To me, it seems like this would give wrong assumptions
to the caller.
The reason I ask is because I found
On Friday, 24 July 2015 at 18:55:26 UTC, Frank Pagliughi wrote:
So then, of course, I hope/wonder/assume that the pointer to
the heap is sufficient to keep the heap memory alive, and that
this would be OK from the GC perspective to do something like
this:
B* make_b_thing(int i) { cast(B*)
On Friday, 17 July 2015 at 07:42:09 UTC, Roland Hadinger wrote:
Here's how I would implement the basic behaviour (could be
extended to also forward bidirectional and random access
functions):
---
auto cushion(R)(R r)
if (isInputRange!R)
{
static if (isInfinite!R) {
On Friday, 17 July 2015 at 07:54:43 UTC, FreeSlave wrote:
On Friday, 17 July 2015 at 07:33:43 UTC, Anonymous wrote:
On Friday, 17 July 2015 at 07:14:24 UTC, FreeSlave wrote:
On Thursday, 16 July 2015 at 21:12:05 UTC, anonymous wrote:
I have the following code, working under Win and Linux:
On Friday, 24 July 2015 at 21:51:44 UTC, Frank Pagliughi wrote:
So then: is there a pointer notation to which you can cast the
B reference, which thus points to the heap, but retains type
identity of the heap object?
There's no straight forward way to do that. D has no types for
the actual
On Tuesday, 14 July 2015 at 01:05:21 UTC, jmh530 wrote:
Note: some of the above seemed to only work when I kept the
std.math.cos, std.math.sin text in there. When I take it out, I
get warnings about recursive aliases.
Yeah, you can't do `alias cos = givemeabettername!cos;`. That
would define
I have the following code, working under Win and Linux:
---
import std.process: environment;
immutable string p;
static this() {
version(Win32) p = environment.get(APPDATA);
version(linux) p = /home/ ~ environment.get(USER);
version(OSX) p = ?;
}
---
what would be the OSX
On Friday, 17 July 2015 at 07:14:24 UTC, FreeSlave wrote:
On Thursday, 16 July 2015 at 21:12:05 UTC, anonymous wrote:
I have the following code, working under Win and Linux:
---
import std.process: environment;
immutable string p;
static this() {
version(Win32) p =
On Friday, 17 July 2015 at 12:18:56 UTC, TC wrote:
Hello,
I came around a strange behavior and I'm not sure if it is a
bug or feature.
import std.typecons : Nullable;
struct Foo
{
string bar;
Nullable!int baz;
}
auto a = Foo(bb);
auto b = Foo(bb);
assert(a == b);
This ends
On Saturday, 18 July 2015 at 16:18:30 UTC, Clayton wrote:
Thanks , you were right . It seems there are some key words
though which one has to use so that the code gets executed on
compile-time .For example I had to change the second forloop to
a foreach loop,
`for` loops work just fine in
On Monday, 20 July 2015 at 08:53:52 UTC, Clayton wrote:
What could be the best-tool for monitoring the evaluation time
of a variable . What I usually do is run the command :-
- dmd -J. program.d
Then I inspect the program.o file using vi for presence of
compile-time constants and enums. I am
On Tuesday, 14 July 2015 at 14:02:46 UTC, jmh530 wrote:
Thanks for posting that. I figured out the issue. Before you
had recommended that I use
alias cos = std.math.cos;
I had kept that text in. When I removed it, everything worked
just fine. I'm still not sure I grasp the subtleties of alias
On Tuesday 25 August 2015 06:55, Laeeth Isharc wrote:
http://www.nytimes.com/2015/08/23/magazine/the-creative-apocalypse-that-wasnt.html
Interesting article as it corrects misconceptions of a few years
back by looking at the data. This is based on tools from EMSI,
who are a D shop.
On Wednesday, 21 October 2015 at 14:06:54 UTC, Shriramana Sharma
wrote:
import std.stdio, std.range;
void mywrite(char [5] chars, real[5] vals)
{
static string [5] fmts = ["%9.4f, ", "%9.4f; ", "%3d, ",
"%3d, ",
"%3d\n"];
foreach (e; zip(chars, fmts, vals)) write(e[0], " = ",
On 24.10.2015 15:18, Shriramana Sharma wrote:
int a[] = [1,2,3,4,5];
Aside: `int[] a;` is the preferred style for array declarations.
How to make it so that after clearing `a`, `b` will also point to the same
empty array? IOW the desired output is:
[1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
[]
[]
On Sunday, 25 October 2015 at 11:45:53 UTC, Shriramana Sharma
wrote:
http://dlang.org/arrays.html#resize says: """Also, you may wish
to utilize the phobos reserve function to pre-allocate array
data to use with the append operator."""
I presume this means
On Thursday, October 22, 2015 08:10 PM, Nordlöw wrote:
> How do I convert a `string` containing Unicode escape sequences
> such as "\u" into UTF-8?
Ali explained that "\u" is already UTF-8.
But if you actually want to interpret such escape sequences from user input
or some such, then
On 22.10.2015 21:13, Nordlöw wrote:
Hmm, why isn't this already in Phobos?
I think parsing only Unicode escape sequences is not a common task. You
usually need to parse some larger language of which escape sequences are
only a part. For example, parsing JSON or XML are common tasks, and we
On 22.10.2015 06:14, Shriramana Sharma wrote:
anonymous wrote:
Huh. I can't find any specification on this, but apparently the local
overload set shadows any imported overload sets completely.
Should I file a bug on this then?
I'm not sure. Maybe make a thread on the main group first. It's
On Wednesday, October 21, 2015 08:28 PM, Shriramana Sharma wrote:
> Kagamin wrote:
>
>> http://dlang.org/hijack.html
>
> Thanks people, but even as per the rules:
>
> 1. Perform overload resolution independently on each overload set
> 2. If there is no match in any overload set, then error
>
On Wednesday, October 21, 2015 07:53 PM, Sigg wrote:
> void func() {
> int a = -10;
> ulong b = 0;
> ulong c = a + b;
> writefln("%s", c);
> }
>
> out: 18446744073709551574
>
> But shouldn't declaring c as auto force compiler to go extra step
>
On 29.10.2015 19:59, Edwin van Leeuwen wrote:
On Saturday, 24 October 2015 at 11:04:14 UTC, Edwin van Leeuwen wrote:
I am trying to write a function to merge two named structs, but am
completely stuck on how to do that and was wondering if anyone good
provide any help. I know I can access the
On 07.11.2015 16:59, anonymous wrote:
Wat. It even compiles with @safe. That's not good.
Filed an issue:
https://issues.dlang.org/show_bug.cgi?id=15315
On 08.11.2015 08:17, Sliya wrote:
I am on Mac OS, but I still don't get it. If the import was not
case-sensitive, I would not have any error since the good file would
have been loaded... Here I have no error saying file not found yet the
file is not loaded. I'd love to know what really happens.
On 12.11.2015 06:27, ric maicle wrote:
I was playing with __traits and tried the code below.
Shouldn't the compiler emit a warning that I'm defining isPOD
multiple times and/or I'm defining something that is built-in
like isPOD?
// DMD64 D Compiler v2.069
import std.stdio;
struct isPOD {
bool
On 13.11.2015 18:44, Ish wrote:
immutable int* j = new immutable int(i);
gives error:
locks1.d:27: error: no constructor for immutable(int);
Looks like your D version is rather old. I had to go back to dmd 2.065
to see that error. 2.065 is from February 2014. We're at 2.069 now. I'd
I was playing with some code someone posted on the forum that
involved opDispatch and compile time parameters. I pasted it in a
file named templOpDispatch.d, ran it, and got an error. Then I
noticed if I renamed the file it worked.
The source didn't matter; same thing happens with an empty
On 14.11.2015 07:30, MesmerizedInTheMorning wrote:
https://issues.dlang.org/show_bug.cgi?id=15331
but it's true !
There's **nothing** to check the availability of a Key. At least I would
expect opIndex[string key] to return a JSONValue with .type ==
JSON_TYPE.NULL, but no...
Also If it was
On 14.11.2015 15:17, Relja wrote:
- std.conv.to!string() works on a static array, when called directly on
the array object, but gives the compile error when called on the
returning object from a function.
[...]
void main() {
getFloat3().to!string; // does not compile
(new
On 17.11.2015 15:32, maik klein wrote:
template tupIndexToRange(alias Tup, Indices...){
[snip]
I don't quite understand how that code is supposed to work. Maybe
there's just some detail missing, but it could also be that your
approach can't work.
This is roughly what I want to achieve
On 30.10.2015 21:23, TheFlyingFiddle wrote:
Is this intended to work?
struct A
{
__gshared static this()
{
//Add some reflection info to some global stuff.
addReflectionInfo!(typeof(this));
}
}
I just noticed this works in 2.069, is this intended?
static
On 01.11.2015 23:49, Adam D. Ruppe wrote:
Yeah, just make the other args normal runtime instead of template:
Or make it two nested templates:
template show(T ...)
{
void show(string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__)()
{
...
}
}
On 06.11.2015 20:05, Spacen Jasset wrote:
Also, I had to add a dummy private constructor to make my structs
'createable', or is there another way?
e.g.
struct Texture
{
@disable this();
static Texture create()
{
return Texture(0);
}
...
private:
this(int)
{
On 07.11.2015 15:36, Mike Parker wrote:
It's actually possible to use move one instance
into another, though:
void main() {
import std.algorithm : move;
ku k1 = ku(1);
ku k2 = ku(2);
k2.move(k1);
assert(k1.id == 2);
}
Wat. It even compiles with @safe. That's not good.
On 05.11.2015 21:30, Handyman wrote:
Seems that 4 cores go all out on first 4 dishes, then 1 core deals with
the last dish. With 4 cores I expect diner is ready after 5/4 = 1.25
secs though. What did I do wrong?
You describe the situation correctly. The unit of work is a dish. That
is, the
On 05.11.2015 21:43, Handyman wrote:
foreach (i; 0..50)
Thread.sleep(20.msecs);
But then my program still says: '2 secs'. Please enlighten me.
Let's look at the line that does the `parallel` call:
foreach (dish; parallel(dishes, 1)) dish.prepare();
This means that `dishes` is
On 05.11.2015 21:52, Handyman wrote:
On Thursday, 5 November 2015 at 20:45:25 UTC, Ali Çehreli wrote:
That's still 1 second per task. The function prepare() cannot be
executed by more than one core.
Thanks. OK. So 'prepare' is atomic? Then let's turn it around: how
can I make the cores
On Monday, October 19, 2015 04:14 PM, Handyman wrote:
> Is the following possible in D? To call a (unary) function f
> with variable a, and let f print:
>
>> Called with argument named 'a'.
>
> I am of course asking for a generic solution, independent of the
> actual variable name (in this
On Monday, October 19, 2015 04:51 PM, Stewart Moth wrote:
> struct Vector(type, int dimension_){ ... }
>
> Where type is going to be an int/float/etc and dimension_ is
> 2/3/4.
>
> I could write a bunch of functions for each case, but I'd rather
> not... I'd like to use something like the
On Wednesday 07 October 2015 02:22, Steven Schveighoffer wrote:
> On 10/6/15 4:27 PM, anonymous wrote:
[...]
>> void foo(T...)(string str=null, T args = T.init) {
[...]
> I find it quite fascinating that in anonymous' solution, the T.init
> doesn't ever actually get used!
It's not used with
On Thursday, October 15, 2015 11:48 PM, Random D user wrote:
> Should array have clear() as well?
> Basically wrap array.length = 0; array.assumeSafeAppend();
> At least it would then be symmetric (and more intuitive) with
> built-in containers.
No. "clear" is too harmless a name for it to
On Friday, October 16, 2015 02:03 PM, Per Nordlöw wrote:
> zip(r, r.dropOne).map!((t) => t[1]-t[0]);
You should r.save one or both of those. The dropOne may affect both
instances if you don't .save.
By the way, what's the point of `dropOne` over `drop(1)`? It's not shorter.
Does it do
On Friday, October 16, 2015 12:35 PM, Shriramana Sharma wrote:
> Why can't a function that takes an immutable argument be called with a
> mutable input at the call site?
>
> IOW, why isn't mutable implicitly convertible to immutable?
immutable says that the data won't ever change. If references
On Saturday, October 17, 2015 04:17 PM, steven kladitis wrote:
> // it thows a range exception
On which line?
On Saturday, October 17, 2015 04:50 PM, steven kladitis wrote:
> core.exception.RangeError@sokuban.d(84): Range violation
Line 84 being this:
sDataBuild ~= sMap[ch];
Where sMap is:
/*static*/ immutable sMap =
[' ':' ', '.':'.', '@':' ', '#':'#', '$':' '];
On Saturday, October 17, 2015 05:36 PM, Shriramana Sharma wrote:
> In Python there is:
>
> if __name__ == "__main__":
>
> to allow the same source file to be treated as both an importable library
> and as an executable script. In D is there any such mechanism to make a
> main() compiled
On Monday 12 October 2015 07:28, Ali Çehreli wrote:
> For example, you cannot get current time at run time.
I think you mean compile time here.
On Monday 12 October 2015 07:23, Rikki Cattermole wrote:
> On 12/10/15 6:19 PM, Andre wrote:
[...]
>> // assert("foo "~ true ? "bar" : "baz" == "foo bar"); does not
compile
[...]
> I read it as:
>
> assert("foo "~ (true ? ("bar") : ("baz" == "foo bar")));
>
> Oh hey look:
>
On Monday 12 October 2015 17:38, ric maicle wrote:
> I'm wondering if this small irregularity should be made consistent or
> maybe I misunderstood something.
As far as I know, the difference just happened, and there is point to it.
The style without "=" is older and wasn't followed when new
On Monday 12 October 2015 17:39, TheFlyingFiddle wrote:
> "foo" ~ true
>
> How does this compile? All i can see is a user trying to append a
> boolean to a string which is obvously a type error. Or are they
> converted to ints and then ~ would be a complement operator? In
> that case..
On Monday 12 October 2015 19:46, anonymous wrote:
> and there is point to it
Ugh, should have been: and there is *no* point to it.
On Tuesday 06 October 2015 17:39, Ali Çehreli wrote:
> I would expect the following to work:
>
> writeln( -9_223_372_036_854_775_808L);
>
> But it doesn't compile:
>
>Error: signed integer overflow
>
> It looks like a compiler bug to me. If so, a very embarrassing one. :)
On Tuesday, 6 October 2015 at 14:46:56 UTC, tcak wrote:
Maybe I am just too stressed out to see the problem.
[code]
import std.stdio;
void main(){
size_t dec = 0;
writeln( dec, " ", (dec <= -10), " ", (dec >= 10), " ", ((dec
<= -10) || (dec >= 10)) );
}
[/code]
[output]
0 true
On Tuesday 13 October 2015 15:47, Suliman wrote:
> something like: auto content = file.byLine.map!("start " ~ a=>a ~
> " end");
That's not how it works at all. Maybe stick to the examples of whatever
resource you're learning from, for now.
On Tuesday 13 October 2015 15:42, Suliman wrote:
> map!(a=> a~=" +") work fine, but how to add before
> at same time?
Use ~ instead of ~=, like so: map!(a => "+" ~ a ~ "+")
301 - 400 of 560 matches
Mail list logo