On Saturday, 18 July 2015 at 02:28:09 UTC, tcak wrote:
I even am not sure how in the world it allows implicit
conversion from class to struct in "fine" at all.
Given:
struct Foo {
T x;
alias x this;
}
Any time you do
Foo foo;
foo.something = whatever;
// or
foo = whatever;
// or
what
On Saturday, 18 July 2015 at 02:23:26 UTC, rcorre wrote:
Is there any reason why implicit conversion from Foo to Thing
is permitted in a regular method but not in a constructor?
In the constructor, you are supposed to be constructing things,
so the first "assignment" of structs is actually a c
On Thursday, 16 July 2015 at 07:20:16 UTC, Fusxfaranto wrote:
An associative array of Variant[string] ought to do the job
well enough.
http://dlang.org/phobos/std_variant.html
For extra fun, you can implement the '.' style syntax pretty
easily:
---
import std.variant;
struct LuaTable {
On Saturday, 18 July 2015 at 02:28:09 UTC, tcak wrote:
I even am not sure how in the world it allows implicit
conversion from class to struct in "fine" at all.
The 'alias this' in the struct permits implicit conversion.
I _think_ that is intended behavior, though I admit I'm not
actually sur
On Saturday, 18 July 2015 at 02:23:26 UTC, rcorre wrote:
Is there any reason why implicit conversion from Foo to Thing
is permitted in a regular method but not in a constructor?
Trying to figure out whether this is a bug or some sort of
constructor-specific safety precaution.
struct Thing {
Is there any reason why implicit conversion from Foo to Thing is
permitted in a regular method but not in a constructor?
Trying to figure out whether this is a bug or some sort of
constructor-specific safety precaution.
struct Thing {
Foo foo;
alias foo this;
}
class Foo { }
class Bar {
On Friday, 17 July 2015 at 23:44:25 UTC, Tamas wrote:
I used DMD, BTW.
what compile flags?
On Monday, 13 July 2015 at 09:46:26 UTC, Minas Mina wrote:
I have written a script that visits all directories in the
current directory and executes a command. In my case, "git
pull".
When running the script serially, everything is fine. All git
repositories are pulled.
But I'd like to pull
On Friday, 17 July 2015 at 22:05:45 UTC, kerdemdemir wrote:
Sad times with linear algebra libraries for me,
Since I can't get rows and columns easily with Scid, It seems
not flexible for me. And also there are other issues for
example I can't set matrix to row or column major.
I begin to ch
On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote:
Although this code is fully operational, presents nice api and
compile-time optimizations, the extra Struct wrapper is not
without runtime penalty.
Is there a solution that results the same static optimizations,
but has no runtime penalty,
On Friday, 17 July 2015 at 23:16:51 UTC, ZombineDev wrote:
On Friday, 17 July 2015 at 23:15:31 UTC, ZombineDev wrote:
On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote:
Is there a solution that results the same static
optimizations, but has no runtime penalty, i.e. the functions
just operat
On Friday, 17 July 2015 at 23:15:31 UTC, ZombineDev wrote:
On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote:
Is there a solution that results the same static
optimizations, but has no runtime penalty, i.e. the functions
just operates with ints? (At least when compiled)
Did you try looking
On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote:
Is there a solution that results the same static optimizations,
but has no runtime penalty, i.e. the functions just operates
with ints? (At least when compiled)
Did you try looking at assembly generated by GDC or LDC with full
optimization
bump
Sad times with linear algebra libraries for me,
Since I can't get rows and columns easily with Scid, It seems
not flexible for me. And also there are other issues for example
I can't set matrix to row or column major.
I begin to check alternatives first I begin to investigate Dlib.
D lib ma
On Friday, 17 July 2015 at 17:56:51 UTC, sigod wrote:
On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote:
eager approach, since it's more straightforward.
What makes you think it's always more straightforward?
Sometimes (like in this case with MongoDB) you cannot write
eager approach
I got inspired by Andrei's "Generic Programming Must Go" talk:
https://www.youtube.com/watch?v=mCrVYYlFTrA
I.e. writing functions with static if-s, based on what we know
about the input.
So the question is how to annotate the input variables?
Adam showed an excellent solution for this, by wrap
All I can find is add-local. Thanks!
On Friday, July 17, 2015 18:43:26 DLangLearner via Digitalmars-d-learn wrote:
> Excuse me for my trivial question, but I'd like to know how to
> convert byte array to float? What I could think of are
> cast(float)(byte[]) and to!float(byte[]) but they do not work for
> me. Thanks!
You could use st
On Friday, 17 July 2015 at 18:58:33 UTC, byron wrote:
On Friday, 17 July 2015 at 18:53:24 UTC, byron wrote:
On Friday, 17 July 2015 at 18:43:27 UTC, DLangLearner wrote:
Excuse me for my trivial question, but I'd like to know how
to convert byte array to float? What I could think of are
cast(fl
On Friday, 17 July 2015 at 19:03:46 UTC, Jacob Carlborg wrote:
On 2015-07-17 20:58, byron wrote:
Ah I miss read, if you want as a float, not a float array you
can do:
byte[] b = [1, 2, 3, 4];
float f = *cast(float*)b.ptr;
not sure if there is a better way
I think a union can be used as wel
On 2015-07-17 19:25, badlink wrote:
My fault, I didn't test the variadic function enough and jumped to
conclusion.
It actually works well http://pastebin.com/R4EHuBLh
Cool :)
Sometimes D developers think templates will be needed to solve everything.
--
/Jacob Carlborg
On 2015-07-17 15:27, anonymous wrote:
Ok so my sample can be rewritten
static this() {
version(Win32) p = environment.get("APPDATA");
version(linux) p = "/home/" ~ environment.get("USER");
version(OSX) p = environment.get("HOME") ~ /Library/Application
Support/;
}
---
I
On 2015-07-17 20:58, byron wrote:
Ah I miss read, if you want as a float, not a float array you can do:
byte[] b = [1, 2, 3, 4];
float f = *cast(float*)b.ptr;
not sure if there is a better way
I think a union can be used as well, not sure if it's better though.
--
/Jacob Carlborg
On Friday, 17 July 2015 at 18:53:24 UTC, byron wrote:
On Friday, 17 July 2015 at 18:43:27 UTC, DLangLearner wrote:
Excuse me for my trivial question, but I'd like to know how to
convert byte array to float? What I could think of are
cast(float)(byte[]) and to!float(byte[]) but they do not work
On Friday, 17 July 2015 at 15:49:46 UTC, Roland Hadinger wrote:
On Friday, 17 July 2015 at 15:47:39 UTC, Roland Hadinger wrote:
Otherwise, I'd use templates and an alias. Maybe this will
result in faster code:
bool opIndexAssign(bool value, size_t[2] inds)
{
void impl(bool b)(s
On Friday, 17 July 2015 at 18:43:27 UTC, DLangLearner wrote:
Excuse me for my trivial question, but I'd like to know how to
convert byte array to float? What I could think of are
cast(float)(byte[]) and to!float(byte[]) but they do not work
for me. Thanks!
You want to include [] in the cast s
Excuse me for my trivial question, but I'd like to know how to
convert byte array to float? What I could think of are
cast(float)(byte[]) and to!float(byte[]) but they do not work for
me. Thanks!
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 end
On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote:
eager approach, since it's more straightforward.
What makes you think it's always more straightforward? Sometimes
(like in this case with MongoDB) you cannot write eager approach
without first writing lazy one.
On Friday, 17 July 2015 at 12:58:58 UTC, Jacob Carlborg wrote:
I don't think I really understand how you want to use/call the
function. Could you give an example with all the different
types you want to call the function?
My fault, I didn't test the variadic function enough and jumped
to conc
On Friday, 17 July 2015 at 14:14:41 UTC, byron wrote:
Since I have yet to use or see anyone use shared in a useful
way I avoid it.
It's one way to avoid it. So, you mean you always use send/receive
when you need threading?
I did small test to know the memory layout.
import core.atomic;
int foo
On Friday, 17 July 2015 at 15:52:45 UTC, TC wrote:
On Friday, 17 July 2015 at 15:30:42 UTC, Meta wrote:
https://issues.dlang.org/show_bug.cgi?id=14804
I'll probably be able to submit a PR for this sometime in the
next few days.
Thanks.
What I don't get is why this one works ok?
import std.t
On Thursday, 16 July 2015 at 03:24:54 UTC, Matthew Gamble wrote:
This member function of my struct uses a function pointer btx.
When the line declaring the function pointer is present I get a
LNK2019 error: unresolved external symbol.
Just guessing, probably because bts and btr are intrinsics?
On Friday, 17 July 2015 at 15:30:42 UTC, Meta wrote:
https://issues.dlang.org/show_bug.cgi?id=14804
I'll probably be able to submit a PR for this sometime in the
next few days.
Thanks.
What I don't get is why this one works ok?
import std.typecons : Nullable;
struct Foo
{
int bar;
On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote:
I'm almost certain that the D database driver returns eagerly
all the results that you've requested. The lazy stuff should
happen when you start doing range operations after the results
are returned from the database. It's not impossibl
On Friday, 17 July 2015 at 15:47:39 UTC, Roland Hadinger wrote:
Otherwise, I'd use templates and an alias. Maybe this will
result in faster code:
bool opIndexAssign(bool value, size_t[2] inds)
{
void impl(bool b)(size_t[2] inds)
{
static if(b)
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal
wrote:
Thanks. Its a lot more cleaner and syntactically readable
having .array at the end. But about laziness the same applies
to clojure and scala. In clojure you must force evaluate the
list, in scala you must to mostly the same as
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 end
On Friday, 17 July 2015 at 07:56:48 UTC, aki wrote:
On Thursday, 16 July 2015 at 09:17:47 UTC, Daniel Kozák wrote:
class DerivedThread : Thread {
shared int count = 0;
}
I thought shared is only for whole of the object.
auto thr = new DerivedThread();
Here, "thr" is not shared but it's
On Friday, 17 July 2015 at 12:44:57 UTC, anonymous wrote:
The building blocks are there. You're `map`ping the original
range to `Nullable`, and then you're `chain`ing an infinite
range (`cycle`) of nulls behind.
import std.range: isInputRange;
auto cushion(R)(R r)
if (isInputRange!R)
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 end
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, 17 July 2015 at 10:19:22 UTC, Márcio Martins wrote:
On Friday, 17 July 2015 at 07:42:09 UTC, Roland Hadinger wrote:
At this moment I'm tempted to implement a function taking a
range of elements E and returning an infinite range of
Nullable!E.
[...]
Wouldn't it still require the a
On 2015-07-17 09:14, FreeSlave wrote:
Hello. You may take a look at this library
https://github.com/MyLittleRobo/standardpaths
OSX version uses Carbon though. You may want to use Cocoa API (which is
newer), but it's Objective-C.
DMD master now has some initial support for Objective-C.
--
/Jac
On 2015-07-16 18:49, badlink wrote:
The method with the variadic function works, but I would have to use
only one parameter because this doesn't work:
fun(const(char[])[] a, const(char[])[] b ...)
and is a bit ugly in my use case ...
I don't think I really understand how you want to use/call t
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal
wrote:
Or loop it. But its pretty nice to know that there is laziness
in D, but when I query mongo I expect all docs to be retrieved,
since there are no paging in the underlying queries? Thus,
having a lazy functionality on top of no
On 2015-07-16 23:12, anonymous wrote:
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(OS
On 2015-07-17 09:33, Anonymous wrote:
So for a software named 'SuperDownloader2015' it would be
$HOME/Library/Application Support/SuperDownloader2015
right ?
so it's not user-specific and it's writable for the current user ?
sorry but it looks a bit strange, anyone can confirm ?
Yes, that'
On Friday, 17 July 2015 at 11:47:30 UTC, sigod wrote:
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal
wrote:
But its pretty nice to know that there is laziness in D, but
when I query mongo I expect all docs to be retrieved, since
there are no paging in the underlying queries? Thus
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) { retu
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 up with: Called `get' on null Nullable!int
But if
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal
wrote:
But its pretty nice to know that there is laziness in D, but
when I query mongo I expect all docs to be retrieved, since
there are no paging in the underlying queries? Thus, having a
lazy functionality on top of non lazy db qu
On Friday, 17 July 2015 at 07:42:09 UTC, Roland Hadinger wrote:
At this moment I'm tempted to implement a function taking a
range of elements E and returning an infinite range of
Nullable!E.
[...]
Wouldn't it still require the algorithms to check if an element
isNull()? Calling get() on a n
On Thursday, 16 July 2015 at 20:41:21 UTC, ZombineDev wrote:
On Thursday, 16 July 2015 at 20:17:54 UTC, Jarl André Hübenthal
wrote:
On Thursday, 16 July 2015 at 20:00:38 UTC, Ali Çehreli wrote:
On 07/16/2015 12:35 PM, "Jarl
=?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?= "
wrote:
Hi
using mongo with vi
Hi,
I want to use Scid matrixes for implementing GMM algorithm. I
will start by writing Naive Bayes with linear and quadratic
decision boundaries .
I reliaze Scid does not provides any functions for getting
spesific row or coloumn. Matrixwview class only supplies opIndex
function.
Is the
On Thursday, 16 July 2015 at 09:17:47 UTC, Daniel Kozák wrote:
class DerivedThread : Thread {
shared int count = 0;
}
I thought shared is only for whole of the object.
auto thr = new DerivedThread();
Here, "thr" is not shared but it's member thr.count is shared?
But if it's not shared,
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:
---
import std.process: environment;
immutable string p;
sta
At this moment I'm tempted to implement a function taking a range
of elements E and returning an infinite range of Nullable!E.
With this function ("cushion" for a lack of better name) I could
do:
auto a = [0,1,2,3,4,5,6,7,8,9];
foreach (e ; a.cushion.take(20))
writeln(e); //
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 = environment.get("APPDAT
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 = environment.get("APPDATA");
version(linux) p = "/home/" ~ environment.get("USE
61 matches
Mail list logo