On Saturday, 7 April 2018 at 19:21:30 UTC, Simen Kjærås wrote:
import std.meta;
import std.traits;
// List all member functions, and wrap them such that
myFoo.fun(3) can be called as
AllMemberFunctions!(typeof(myFoo))[idx](myFoo, 3).
template AllMemberFunctions(T)
{
template createDg(alia
On Tuesday, 17 April 2018 at 21:45:45 UTC, Dr.No wrote:
give structs like this:
struct A
{
int a = 10;
string s = "haha";
}
struct B
{
A aDetails;
}
but neither fullyQualifiedName nor stringof give the symbol in
the way I need.
I'd hint you towards
import std.traits
The following should depict what I'm trying to achieve:
```
import std.stdio;
enum menum { A, B, C }
void main()
{
foo(menum.B);
}
void foo(menum e)
{
// Not possible
// run time variable 'e' in conjunction with template 'Temp'
writeln(Temp!(GetMenum(e)));
}
static int i =
On Thursday, 26 April 2018 at 16:46:11 UTC, Simen Kjærås wrote:
The only step you're missing is the template needs to be
instantiated inside the static foreach, like this:
auto instantiateWith(alias Fn, T)(T x)
if (is(T == enum))
{
import std.traits : EnumMembers;
switch (x)
{
Bumped across another problem : /
```
import std.stdio;
enum menum { A, B, C }
void main()
{
foo(menum.A);
}
void foo(menum e)
{
writeln(instantiateWith!Temp(e));
}
auto instantiateWith(alias Fn, T)(T x)
if (is(T == enum))
{
switch (x)
{
import std.traits : EnumMemb
On Friday, 27 April 2018 at 13:39:22 UTC, Simen Kjærås wrote:
That's an unfortunate error message. The problem is TempStruct
is defined inside the Temp template. In the same way that
struct Foo(T) {} is different for Foo!int and Foo!string,
TempStruct is a different type for Temp!(menum.A) and
On Friday, 27 April 2018 at 14:33:36 UTC, Alex wrote:
On Friday, 27 April 2018 at 13:43:47 UTC, Timoses wrote:
`instantiateWith` gets called in three variations (menum.A,
menum.B and menum.C). This causes instantiateWith to return
TempStruct for each case of Temp...
However, I was under the
Hey,
reading through https://dlang.org/articles/const-faq.html and
experimenting a bit:
```
immutable int i = 3;
const(int)* p = &i;
int* q = cast(int*)p;
assert(q == p && p == &i);
writeln(i); // 3
*q = 1; // Why does this have no effect at all? No error
no not
On Tuesday, 1 May 2018 at 15:24:09 UTC, Robert M. Münch wrote:
Hi, I'm mostly doing simple C-API wrappers around C++ code to
access thigns from D. However, I wanted to try how far I can
come using C++ directly.
I have the following C++ code in namespace N:
class Image : public Object {
On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:
tried defining items[] as both "Item[] items" and "Item* items"
in d, it compiles okay but gives an error when trying to access
it.
You were on the right track. D array notation is:
[] ;
For me this works:
```
struct Item
{
int id;
};
On Thursday, 3 May 2018 at 11:29:59 UTC, Robert M. Münch wrote:
Not sure I understand this too. This is now what I get:
DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class
b2d::Image & __ptr64,class b2d::Context2D::InitParams const *
__ptr64 const) __ptr64
LIB: public: unsigned int
On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote:
Hi Timoses,
The structure is being returned from c and I'd like use it from
d.
What you have work perfectly when assigning from d.
Regards,
NewUser
Then you probably need some `extern(C)` statement introducing the
C function and the s
On Monday, 7 May 2018 at 10:28:14 UTC, drug wrote:
I get the error like:
```
./foo/bar/baz/builder.d(57,23): Error: template instance
`staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive
template expansion
```
That's all. It doesn's print instantiations stack so I can't
track back the r
On Saturday, 2 June 2018 at 18:10:38 UTC, eastanon wrote:
Does D array implementation support an array of null values?
int a[4] = null;
But I ran into a type error while checking if a[i] is null
foreach(i; 0..3){
if(i == null){
writeln("it is null");
}
}
}
How do you set fixed size a
On Saturday, 16 June 2018 at 01:53:15 UTC, DigitalDesigns wrote:
Does ranges have the ability to store a temp value in a "range
like way" that can be used later?
The idea is to avoid having to create temp variables. A sort of
range with "memory"
I believe that if the range is a forward range
On Thursday, 14 June 2018 at 17:07:09 UTC, Jonathan M Davis wrote:
Sure, it would save you a little bit of typing when you do
something like
auto foo = new Foo;
if makes it immutable for you, but it's at the cost of code
clarity.
Why should it even?
Isn't
immutable class C
{
On Thursday, 14 June 2018 at 11:31:50 UTC, Robert M. Münch wrote:
I have a simple tree C data-structure that looks like this:
node {
node parent:
vector[node] children;
}
I would like to create two foreach algorthims, one follwing the
breadth first search pattern and one the de
On Sunday, 17 June 2018 at 10:58:29 UTC, Cauterite wrote:
Hello,
I'm not sure whether I'm missing something obvious here, but is
there a reason for scope(success) being lowered to a try-catch
statement?
I would have expected only scope(exit) and scope(failure) to
actually interact with excepti
On Thursday, 21 June 2018 at 18:46:05 UTC, Dr.No wrote:
How can I do that with D?
In C# you can do that:
var filename = @"C:\path\to\my\file.txt";
var file = new Uri(filename).AbsoluteUri;
// file is "file:///C:/path/to/my/file.txt"
How can I do that in D?
I don't know of a specific implemen
On Thursday, 3 May 2018 at 10:27:47 UTC, Pasqui23 wrote:
Last commit on https://github.com/buggins/hibernated
was almost a year ago
So what is the status of HibernateD?Should I use it if I need
an ORM? Or would I risk unpatched security risks?
Okay... wall of text.
TLDR: project definition /
On Sunday, 24 June 2018 at 03:46:09 UTC, Dr.No wrote:
string html = get(page, client).text;
auto document = new Document();
document.parseGarbage(html);
Element attEle = document.querySelector("span[id=link2]");
Element aEle = attEle.querySelector("a");
string link
On Sunday, 24 June 2018 at 11:44:06 UTC, Dechcaudron wrote:
Hi,
I'm trying to use dub to compile a quick experiment that uses
Deimos libclang bindings, which of course requires linking
against an installed libclang. I believe this is what I need to
include in dub.json:
"systemDependencies"
On Monday, 25 June 2018 at 17:45:01 UTC, zbr wrote:
Hi, this question is not specifically D related but I'll just
ask anyway. Consider the following snippet:
void mergeSort(int[] arr, int l, int r)
{
if (l < r) // 1
{
int m = l+(r-l)/2;// 2
me
On Wednesday, 27 June 2018 at 12:02:10 UTC, aliak wrote:
This currently fails unless you mark the class as static:
auto construct(T)() {
return new T;
}
void main() {
class C {}
auto s = construct!C;
}
So wondering if there's anything that can be done to get the
above working?
O
On Thursday, 28 June 2018 at 08:01:42 UTC, vino.B wrote:
Hi All,
Request your help on how to get the source code, i wrote a
program named clean.d, complied it and by mistake deleted the
source code(clean.d), so can we get back the source using the
complied program(clean), if yes, can you an
On Thursday, 28 June 2018 at 14:35:33 UTC, Mr.Bingo wrote:
Seems like it would unify things quite a bit.
import std.typecons, std.range, std.array, std.algorithm,
std.stdio;
void main()
{
auto t = tuple(3,4,5,6);
//auto t = [3,4,5,6];
writeln(t.map!(a => 3*a).
On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote:
This doesn't appear to specifically be a Vibe issue, just
noticing this error when I use eventcore from it (trying to use
async).
C:\dmd2\windows\bin\lld-link.exe: warning:
eventcore.lib(sockets_101f_952.obj): undefined symbol:
SetWind
On Friday, 29 June 2018 at 20:08:56 UTC, Robert M. Münch wrote:
On 2018-06-29 18:05:00 +, Ali ‡ehreli said:
On 06/29/2018 09:44 AM, Robert M. Münch wrote:
void handler(alias func)(C[] cs) {
foreach (c; cs) {
func(c);
}
}
Is it possible to make C[] a template type so th
On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote:
I hope this is understandable... I have:
class C {
void A();
void B();
void C();
}
I'm iterating over a set of objects of class C like:
foreach(obj; my_selected_objs){
...
}
The iteration and code
On Friday, 29 June 2018 at 20:28:55 UTC, Timoses wrote:
On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote:
Trying to fiddle around a bit with delegates.. But why is the
context for delegates not working for classes??
Aw.. Class = reference type so
class A { }
struct B { }
void d
On Saturday, 30 June 2018 at 21:11:54 UTC, Anonymouse wrote:
I have a template that I want to provide easy aliases for,
where the aliases includes (partially applies?) a template
parameter.
void fooImpl(char token, T)(const T line)
{
// ...
}
alias quoteFoo(T) = fooImpl!('"', T);
would
On Sunday, 1 July 2018 at 06:55:35 UTC, Robert M. Münch wrote:
The looping needs to be done in the handler because there are
two loops running one after the other and the range to loop
over is detected in the handler too. Otherwise a lot of code
duplication would happen.
Maybe an applicatio
On Sunday, 1 July 2018 at 01:48:15 UTC, Simen Kjærås wrote:
I'd send you straight to std.meta.ApplyLeft, but it seems to do
the wrong thing here, in that it doesn't handle IFTI. This
thing does:
void fooImpl(int n, T)(const T line) { }
unittest {
alias fun = applyLeft!(fooImpl, 3);
On Sunday, 1 July 2018 at 09:46:32 UTC, vino.B wrote:
All,
Request your help, the D document states that "Template
functions are useful for avoiding code duplication - instead of
writing several copies of a function, each with a different
parameter type, a single function template can be s
On Sunday, 1 July 2018 at 11:19:50 UTC, vino.B wrote:
On Sunday, 1 July 2018 at 09:55:34 UTC, Timoses wrote:>
Hi Timoses,
Thank you very much, can you help me on how to rewrite the
below using Variadic template
Passing function as a parameter to another function:
void ptFun(T)(T function(s
On Sunday, 1 July 2018 at 11:58:30 UTC, vino.B wrote:
On Sunday, 1 July 2018 at 11:52:19 UTC, Alex wrote:
NewType.d(19): Error: function declaration without return type.
(Note that constructors are always named this)
[...]
auto coCleanFiles(T ...)(T args) {
auto dFiles = Array!(Tuple!(string
On Sunday, 1 July 2018 at 11:55:15 UTC, Simen Kjærås wrote:
On Sunday, 1 July 2018 at 09:46:55 UTC, Timoses wrote:
Would be nice if std.meta.ApplyLeft did the job here.. Is
there no way of achieving that?
[snip]
Would have to find a way to determine whether Template would
resolve to a function
On Sunday, 1 July 2018 at 13:01:20 UTC, Timoses wrote:
Aw, okay, then that won't work.
Still, this looks like it should work:
void foo(F, T)(T param) { writeln("Called with type: ",
T.stringof); }
alias tfoo = ApplyLeft!(foo, int);
tfoo!string("hi");
// tfoo("hi"); // Error
How can I return inferred storage class from interface functions?
I can't use auto as return value in interface. Neither can I use
"inout" as I don't pass a parameter.
// Ref Type
interface IRef
{
Ref opIndex(size_t idx) const;
}
class CRe
On Wednesday, 4 July 2018 at 15:12:15 UTC, Jonathan M Davis wrote:
You can make opIndex inout instead of const. That way, inout
applies to the invisible this reference, just like it would
with const.
Awww, thanks! I was kinda hovering around this[1] section and
didn't quite see the MemberFu
On Thursday, 5 July 2018 at 05:38:29 UTC, Flaze07 wrote:
I have a dub project, and I put the importPath to the path of
the file I want to import and the source file to the source
folder, and it appears that I have succeeded at importing the
module, but there's one problem, it appears like I nee
On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote:
Hi,
the purpose of this code is to generate CSV based on 3 double
arrays.
I wonder why map cannot directly use the result of the chunks
function.
import std.experimental.all;
void main()
{
double[] timestamps = [1.1];
doubl
int fun(T)(T i)
{
static assert(is(typeof(return) == T)); //true
pragma(msg, is(T == return)); // false
static if (is(T ReturnType == return))
pragma(msg, ReturnType); // does not enter
return i;
}
unittest
{
fun(3);
}
Wh
Is this safe?
class A {}
immutable(A) getA()
{
A a;
// .. do stuff with a
// not leaking a to any functions
// is this safe
return cast(immutable A)a;
}
What if A is replaced with A[] or A[int]?
If it's not safe, what would be the proper way to return an
immutable insta
On Thursday, 5 July 2018 at 11:21:41 UTC, Alex wrote:
On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote:
int fun(T)(T i)
{
static assert(is(typeof(return) == T)); //true
pragma(msg, is(T == return)); // false
static if (is(T ReturnType == return))
On Thursday, 5 July 2018 at 11:37:16 UTC, Timoses wrote:
I think it refers to this section:
https://dlang.org/spec/expression.html#is_expression
should mention that I mean the 6th paragraph.
On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote:
int fun(T)(T i)
{
static assert(is(typeof(return) == T)); //true
pragma(msg, is(T == return)); // false
static if (is(T ReturnType == return))
pragma(msg, ReturnType); // does not enter
re
On Thursday, 5 July 2018 at 12:15:35 UTC, vit wrote:
Try pure functions:
class A {}
A getA()pure @safe //pure whitout mutable parameters
guarantees that function doesn't leak data.
{
A a;
// .. do stuff with a
// not leaking a to any functions
// is this safe
re
On Thursday, 5 July 2018 at 16:23:36 UTC, vino.B wrote:
Hi All,
Request your help on the below code
auto coCleanFiles(T ...) (T FFs) {
auto dFiles = Array!(Tuple!(string,
SysTime))(dirEntries(FFs, SpanMode.depth).map!(a =>
tuple(a.name, a.timeCreated)));
return dFiles;
}
void
I dared once again getting into immutable by adding an
"immutable" keyword which causes a chain of actions to be taken.
I feel like I'm lost in a jungle of immutable, inout and pure
(perhaps more will join the party...).
To start off, why does this not work?
class Test
{
On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote:
static auto ref consensus( ... )
`auto ref` infers the return type from the return statement [1].
So it's not necessarily returning a ref type.
However, I don't think this matters if the only concern you have
is that the setter function
On Friday, 6 July 2018 at 14:28:39 UTC, Steven Schveighoffer
wrote:
inout is not a compile-time wildcard, it's a runtime one. So it
doesn't know how to convert an immutable to an inout.
Essentially, inside this function, the compiler has no idea
whether the real thing is an immutable, const, mu
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote:
class Agent
{
private
{
double[int] mDict;
}
// Setter: copy
void beliefs(ref double[int] dict)
{
import std.stdio : writeln;
writeln("Setter function.");
this.mDict = dict;
}
On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote:
This is definitely to do with my use of the setter syntax,
which maybe I am misunderstanding? Because if I change it to a
normal function call like so:
a.beliefs(Operator.create());
then it complains if I use ref, and doesn't complain i
On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote:
Also, yes, I am using the setter method to play around with the
precision of the double values, and do some normalising.
While writing I realized that the following is even the case
without the 'ref' parameter:
The caller of the setter will
On Friday, 6 July 2018 at 15:44:28 UTC, Steven Schveighoffer
wrote:
I'm long overdue for an inout article...
I can point you at my talk from 2016:
https://www.youtube.com/watch?v=UTz55Lv9FwQ
Thanks, will definitely take a look when I get home.
I never really used 'pure' and just now found
On Friday, 6 July 2018 at 17:08:48 UTC, Flaze07 wrote:
[...]
then, I made a project, with this main in this path :
Z:\programming\D\experimentLib\source\main.d
it contains this
module main;
import std.stdio;
import source.output;
Shouldn't this be 'import output'?
void main( string[] a
On Saturday, 7 July 2018 at 08:09:51 UTC, vino.B wrote:
Hi All,
Request you help, on the below code
import std.stdio: writeln;
void process(T ...)(string ID, T args) {
if (ID == "I1") { writeln(args.length, "\t", args[0]); }
else if (ID == "I2") { writeln(args.length, "\t", args[1]);}
}
voi
On Saturday, 7 July 2018 at 08:35:27 UTC, Alex wrote:
On Saturday, 7 July 2018 at 08:24:21 UTC, Timoses wrote:
Interesting.. Looks like the compiler does some boundschecking
during compile time. You could circumvent this:
void process(T ...)(string ID, T args) {
if (ID == "I1") {
On Saturday, 7 July 2018 at 15:25:51 UTC, vino.B wrote:
Hi All,
If we replace the statement as args[$ -1] the program works
are expected, if we apply the same logic in different approach
it does not work, in the below code if we command the first
block "if (fnID == "ListFilesNames") {} " t
On Sunday, 8 July 2018 at 18:46:31 UTC, vino.B wrote:
Hi All,
Request you help, in the below code we pass the function
"Testfun" as a parameter to another function "process" in order
for the function "process" to work we have to specify the type
of the parameter that is passed to the functio
On Monday, 9 July 2018 at 05:54:27 UTC, vino.B wrote:
On Sunday, 8 July 2018 at 19:22:32 UTC, Timoses wrote:
Perhaps you could tell us what your goal is. People here might
come up with a nice solution. Why do you feel like having to
use templated functions in the first place? That is, what is
On Tuesday, 10 July 2018 at 12:05:11 UTC, kdevel wrote:
On Saturday, 7 July 2018 at 13:12:59 UTC, Alex wrote:
The site you cited for the guard clause above (c2.com)
works at runtime.
?
static if works at compile team and only inserts code into the
final code for run-time depending on the co
On Tuesday, 10 July 2018 at 12:10:27 UTC, Jonathan M Davis wrote:
On Tuesday, 10 July 2018 05:38:33 MDT kdevel via
Digitalmars-d-learn wrote:
I would like to suggest an extension of the language by
introducing
static return Expression_opt;
which shall have the effect of a return plus tha
How do I create an inout object with template parameters?
Take following code:
import std.stdio;
import std.traits;
struct S
{
int[] arr;
}
interface I
{
inout(I) opIndex(size_t idx) inout;
}
On Tuesday, 10 July 2018 at 14:58:42 UTC, vino.B wrote:
Hi Alex,
I am getting the output as tuples of multiple arrays, but the
requirement is to get the all the tuple in a single array like
the below so that we can perform sorting and printing the
output is easy.
Something along the way
On Wednesday, 11 July 2018 at 08:31:30 UTC, Dorian Haglund wrote:
Hi.
I'm trying to use taskPool.reduce with a delegate, for example:
import std.parallelism;
int main(string[] args)
{
int f(int a, int b)
{
if (args.length > 1)
return a+b;
else
return a-b;
}
auto re
On Tuesday, 10 July 2018 at 18:01:59 UTC, Steven Schveighoffer
wrote:
You are overthinking :) inout typically is much easier than you
expect, until you need to create temporary structs or types
with inout members, then it becomes problematic.
https://run.dlang.io/is/kosYuC
I had to put in a s
On Wednesday, 11 July 2018 at 16:43:24 UTC, Seb wrote:
I don't know of an easy way to do out of the box.
However, with dmd's new -i option, it could be as easy as:
---
dub fetch requests
cat > test.d << EOF
import std.stdio;
import requests;
void main() {
auto content = postContent("http://
On Wednesday, 11 July 2018 at 12:55:35 UTC, Timoses wrote:
On Tuesday, 10 July 2018 at 18:01:59 UTC, Steven Schveighoffer
wrote:
You are overthinking :) inout typically is much easier than
you expect, until you need to create temporary structs or
types with inout members, then it becomes proble
On Tuesday, 10 July 2018 at 14:34:55 UTC, Timoses wrote:
`Unqual` in this case just turns `inout(int[])` into
`inout(int)[]`, which is why it complains. That's a side effect
of this example [...]
See also:
https://issues.dlang.org/show_bug.cgi?id=3567
On Thursday, 12 July 2018 at 12:22:34 UTC, Steven Schveighoffer
wrote:
On 7/11/18 8:55 AM, Timoses wrote:
class TestA(T : T[])
{
Test!T[] arr;
// ERROR: Can't initialize inout variable in
a for loop...
this(inout(T[]) arr) inout
{
On Thursday, 12 July 2018 at 20:44:43 UTC, JN wrote:
I am trying to make use of the Orange package, I added the
latest version from dub to my project: "orange": "~>1.0.0" and
copy pasted the "simple usage" code from
https://github.com/jacob-carlborg/orange , but I am getting a
long list of err
On Friday, 13 July 2018 at 05:39:24 UTC, JN wrote:
On Friday, 13 July 2018 at 05:29:58 UTC, Timoses wrote:
On Thursday, 12 July 2018 at 20:44:43 UTC, JN wrote:
I am trying to make use of the Orange package, I added the
latest version from dub to my project: "orange": "~>1.0.0"
and copy pasted
On Friday, 13 July 2018 at 11:04:40 UTC, Piotr Mitana wrote:
This code:
import std.stdio;
class X1 {}
class X2 : X1
{
void run() @safe
{
writeln("DONE");
}
}
void main() @safe
{
X1 x1 = new X1;
X2 x2 = cast(X2) x1;
On Friday, 13 July 2018 at 22:17:59 UTC, Dukc wrote:
On Friday, 13 July 2018 at 13:52:27 UTC, Timoses wrote:
I suppose this is another good example of how casting can be
dangerous?
E.g. also:
immutable int i = 3;
int* j = cast(int*)&i;
assert(i == 3);
*j = 4;
assert(j
On Friday, 13 July 2018 at 21:38:18 UTC, JN wrote:
I'm curious, are the tests in any way OS specific? I see the
tests are passing, but trying the latest DMD on Windows and
orange v2.0.0, when I add "@nonSerialized" to a struct member,
I get this:
C:\Users\jacek\Desktop\test_orange>dub run
P
On Saturday, 14 July 2018 at 11:08:21 UTC, Andre Pany wrote:
Hi,
I have a class with methods and I want to call a method by
using a variant array.
The length of the array and the types exactly fits the method
signature.
In the last line of main you see the coding which should be
generated.
On Saturday, 14 July 2018 at 19:04:01 UTC, Andre Pany wrote:
On Saturday, 14 July 2018 at 19:00:56 UTC, Anonymouse wrote:
On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:
Is there a way to find out both paths based on the dmd
executable folder?
What I found out so far, these paths
On Sunday, 15 July 2018 at 00:25:22 UTC, Venkat wrote:
I am writing a simple vibe.d app. The following is what I do
right now.
- I make changes.
- build
- Restart the server.
Is there any tool that will auto publish my changes as I save
them ? I am using Visual Studio Code.
Thanks
Venkat
Why does this fail?
struct F
{
int i;
ushort _x;
void x(ushort v) pure
{_x = v;}
ushort x() const
{ return _x; }
}
immutable F f1 = () pure {
F lf = F();
return lf; }();
// Error: cannot implicitly convert expression del
On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote:
On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote:
Why does this fail?
It doesn't. Not using DMD 2.081.1 under Windows, at least. I
tried adding a bitfield since you mentioned it, but it compiles
nicely for me. Which version o
On Monday, 16 July 2018 at 11:31:32 UTC, Seb wrote:
On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote:
On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev
wrote:
I'll follow up with Alawain. Regardless, dscripten-tools
borrows very little from the redistributable parts of
dscripten
Why is the interface templated function not also returning the
class C toString return value "in C"??
interface iface
{
void toString(scope void delegate(const(char)[]) sink) const;
final string convert() inout
{
On Tuesday, 17 July 2018 at 06:24:12 UTC, Simen Kjærås wrote:
That makes sense. The problem is F has a context pointer to the
main() block, since it's a non-static struct with methods
inside a block. It doesn't actually use the context pointer for
anything, so it possibly shouldn't have one,
On Wednesday, 18 July 2018 at 11:09:12 UTC, Timoses wrote:
Why is the interface templated function not also returning the
class C toString return value "in C"??
interface iface
{
void toString(scope void delegate(const(char)[]) sink) const;
final
On Thursday, 19 July 2018 at 06:35:36 UTC, Simen Kjærås wrote:
On Wednesday, 18 July 2018 at 11:28:54 UTC, Timoses wrote:
But why is a context pointer a problem? Is it problematic
because the context pointer to the main scope can not
guarantee `immutable`? E.g. if I happened to use data from
m
On Thursday, 19 July 2018 at 22:16:22 UTC, Ali Çehreli wrote:
On 07/19/2018 08:12 AM, Emma wrote:
> [...]
> If I try to compile it, dmd complains, which I guess makes
sense:
>
> ---
> Error: need this for bar of type void()
> Error: need this for baz of type void()
> ---
>
> [...]
I think it's a
On Thursday, 19 July 2018 at 19:18:43 UTC, jmh530 wrote:
I wanted to create a struct with a member function whose
behavior was different depending on whether the struct instance
had a particular UDA.
However, it seems like hasUDA doesn't seem to produce the
result I would have expected here.
On Friday, 20 July 2018 at 16:53:12 UTC, jmh530 wrote:
Hmm, on that part about the attributes copying their values, I
suppose it would be sufficient if I could apply the attributes
to a group of declarations. However, it didn't seem to work
properly for me with UDAs, and I noticed that even som
On Monday, 23 July 2018 at 12:02:58 UTC, aliak wrote:
Thank you Ali! That helped :) I've gotten most of it sorted out
now, and the factory wrap is definitely the way to go, it also
turned out that inout(T) and inout T (so inout without parens)
was surprisingly different (maybe it's a bug? - t
On Monday, 23 July 2018 at 18:39:59 UTC, aliak wrote:
Hi,
I'm playing around with an Optional wrapper type. It stores a
type T and a bool that defines whether a value is defined or
not:
struct Optional(T) {
T value;
bool defined = false;
this(U : T)(auto ref inout(U) value) inout {
On Tuesday, 24 July 2018 at 04:43:33 UTC, Guillaume Lathoud wrote:
Hello,
__traits and std.traits already offer access to function
information like input parameters, e.g. in std.traits:
ParameterIdentifierTuple ParameterStorageClassTuple
Even if that might sound strange, is there a compile t
On Tuesday, 24 July 2018 at 14:11:51 UTC, Ali Çehreli wrote:
On 07/24/2018 02:47 AM, Timoses wrote:
> Why does this fail while it works when replacing T with U in
struct
> W(T)?? It's so odd. Both T and U seem to resolve to "string".
>
> struct W(T) {
> const T value;
> //
On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote:
On Friday, 20 July 2018 at 18:24:11 UTC, Timoses wrote:
[snip]
It works in module scope
https://run.dlang.io/is/OQKYag
I don't know why though...
This was reported in 2013. IMO, it should be mentioned in the
spec if they don't plan
On Thursday, 2 August 2018 at 20:35:57 UTC, Steven Schveighoffer
wrote:
Looking at the AST, it appears that toImpl doesn't recognize
what inout(iface) is:
toImpl!(string, inout(iface))
{
@system string toImpl(ref inout(iface) value)
{
import std.array : appende
On Monday, 6 August 2018 at 14:27:01 UTC, Timoses wrote:
On Thursday, 2 August 2018 at 20:35:57 UTC, Steven
Schveighoffer wrote:
Looking at the AST, it appears that toImpl doesn't recognize
what inout(iface) is:
toImpl!(string, inout(iface))
{
@system string toImpl(ref inout(iface) v
On Wednesday, 8 August 2018 at 21:54:34 UTC, aliak wrote:
I'm trying to debug stuff, so I want to add verbose logging
struct S(T) {
this() {
writeln("created S(T) with properties and ID");
}
}
static a = S!int(); // bah
I guess users can call this code from any context, but when i'd
a
On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher wrote:
I already posted this in the vibe.d forums
(https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/58891/), but it seems, there is not a lot of activity over there, so I am cross posting this here:
[...]
Do you
On Monday, 13 August 2018 at 14:16:47 UTC, Mike Parker wrote:
On Monday, 13 August 2018 at 13:09:24 UTC, Andrey wrote:
On Monday, 13 August 2018 at 13:05:28 UTC, evilrat wrote:
however the best option is simply avoid naming anything with
same name as module.
Hmm, I thought that name of class
1 - 100 of 175 matches
Mail list logo