written, allows implementation to have more
fields.
typeof("asd".ptr) gives back immutable(char)*, not immutable(void)*. So
from a user point of view it's as if the array is templated.
--
/Jacob Carlborg
of scope and nothing else points to that data it will collect it
(eventually).
Hope this helps a bit.
--
/Jacob Carlborg
On 2013-06-28 14:46, John Colvin wrote:
Is there any way of getting the body of a function as a string?
(Obviously only when the source code is available to the compiler)
I remember someone someone modified DMD and added a .codeof property or
similar. It was fairly easy.
--
/Jacob Carlborg
info would be different?
That might be the case, didn't think of that. In that case you need
casts anyway.
--
/Jacob Carlborg
for.
You can also hide the cast in a function if you want to be a bit more
clear of the intent:
T instanceOf (T) (Object value)
{
return cast(T) value);
}
if (i.instanceOf!(B)) { }
--
/Jacob Carlborg
On 2013-06-23 13:27, Timon Gehr wrote:
Example?
@(3) int a;
alias Tuple!(__traits(getAttributes, mixin("a"))) attrs;
--
/Jacob Carlborg
re
risk of breaking code.
That's true, I didn't think of that.
--
/Jacob Carlborg
On 2013-06-22 23:51, Timon Gehr wrote:
If that is the only problem then the solution is to allow overloading on
static, which is easy to do.
You still need to call the static method on the class/struct if there's
an ambiguity.
--
/Jacob Carlborg
On 2013-06-22 23:47, Timon Gehr wrote:
No, it is arbitrary.
I think the spec says you can only mixin whole expression. But for some
reason you can use a mixin in a __traits expression without having the
whole expression in a mixin.
--
/Jacob Carlborg
eclared "static". Usually it's
possible to find a different name for one of the methods to avoid
overloading. That's not always the case though, for example, opDispatch.
--
/Jacob Carlborg
it is and call the static method
with the class name, so in this case that would be Foo.test1.
Yeah. It's possible to call any non-virtual method without dereferencing
a null reference.
--
/Jacob Carlborg
y not just move "val" to the base class.
--
/Jacob Carlborg
it finish) .
With that being said there are many things to improve in std.regex
speed-wise, sadly I haven't been able to tell about it at DConf.
I see, thanks for the correction.
--
/Jacob Carlborg
use fs
);
--
/Jacob Carlborg
On 2013-06-18 21:22, Gary Willoughby wrote:
Thanks. Hmmm.. i get 500K (worse performance) using that. :/
D has basically the fastest regular expression library/module. It's
faster than V8.
Any more tips?
How about reading in larger chunks than single lines?
--
/Jacob Carlborg
e a /home/ directory on Mac OS X?
On Mac OS X it's called /Users/.
BTW, running that on Mac OS X 10.6.3 does not cause a crash. Although it
doesn't seem to print or write anything.
--
/Jacob Carlborg
raits(getAttributes) returns a tuple. Try using an alias instead,
something like:
import std.typetuple
alias tp = TypeTuple!(__traits(getAttributes, a));
--
/Jacob Carlborg
On 2013-06-03 17:42, Eric wrote:
Thanks. That fixed my problem. This is my first D program,
so I wouldn't have figured it out on my own...
If it's not obvious, you should terminate the runtime as well when your
program ends. There's a corresponding function for that.
--
/Jacob Carlborg
//github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L281
--
/Jacob Carlborg
It will be run before the runtime is initialized (that's how it
works now). Then people will start using it and complain about there
code failing in mysterious ways because the runtime isn't initialized.
--
/Jacob Carlborg
On 2013-05-23 18:19, David wrote:
For Linux you can use inotify
http://linux.die.net/man/7/inotify
I think the corresponding for Mac OS X is fsevents:
http://en.wikipedia.org/wiki/FSEvents
--
/Jacob Carlborg
mkdir dlang
$ cd dlang
clone DMD, druntime and Phobos
$ dvm compile .
You'll get a couple of new folders in dlang/dmd. A bin and lib folder
with the architecture appended.
--
/Jacob Carlborg
#x27;d think it would need the same sort of functionality when it
does implement it, though.
I don't know if it's automatically linked but here you go:
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dylib_fixes.c
--
/Jacob Carlborg
http://forum.dlang.org/thread/20130512171627.0244@unknown
--
/Jacob Carlborg
rc/rt/dmain2.d#L312
I'm not sure if all this work yet. Using a D shared library from a D
application, "statically" linked, should work on Linux 64bit. Don't know
if it works from a C application.
--
/Jacob Carlborg
On 2013-05-07 13:08, Dicebot wrote:
You may want to update your implementation: http://dpaste.1azy.net/640a2580
Thanks.
--
/Jacob Carlborg
lly accessible at compile time in
the expression (a + b), so why does the compiler complain?
As a workaround for "typeof" you can use this:
https://github.com/jacob-carlborg/orange/blob/master/orange/util/Traits.d#L213
--
/Jacob Carlborg
indows API.
--
/Jacob Carlborg
ou're complaining about Windows. I can tell you that it doesn't look
good for anyone. To get a window on Mac OS X you need to interact with
Objective-C (no I don't want to use Carbon), which is possible but it's
a pain in the ass.
--
/Jacob Carlborg
On 2013-05-01 10:42, Temtaime wrote:
core.sys.windows.windows doesn't have a lot of functions. It doesn't
contain simple function DestroyWindow for example.
Declarations are basically added on a need to need basis.
--
/Jacob Carlborg
On 2013-04-29 20:49, Dan wrote:
Thanks. What is the takeaway? That it does not work and can not work
until these two bugs are fixed? A simple "I don't think you can get
there from here"?
At least these bugs need to be fixed to get demangled symbol names.
--
/Jacob Carlborg
anything older).
in some rare cases we only have the file name but no file path
information.
}
How did you get this working?
--
/Jacob Carlborg
t the command build only (to
keep the binary). The symbols and line numbers are available.
Is there a setup for Mac that others are having success with?
See:
* http://d.puremagic.com/issues/show_bug.cgi?id=8172
* http://d.puremagic.com/issues/show_bug.cgi?id=8207
--
/Jacob Carlborg
a look at this:
https://github.com/d-widget-toolkit/com.ibm.icu
I will most likely not compile with the latest version of DMD. Also I
don't know how complete it is.
--
/Jacob Carlborg
On 2013-04-26 23:25, Nick Sabalausky wrote:
FWIW, This seems to work fine, at least on windows:
import std.process;
version(Windows)
system(`rmdir /S /Q "`~path~`"`);
else
system(`rm -rf '`~path~`'`);
That's cheating.
--
/Jacob Carlborg
er cannot access the driver.
As I understand it the driver chooses the linker flags.
--
/Jacob Carlborg
n already exists,
and if not where to add it. Would these changes be of any use?
In general declarations are order independent. When you start with
nested functions and static-ifs it become order dependent.
--
/Jacob Carlborg
.
Also the program I'm compiling is bringing up a console window when it
runs, even though I'm setting the subsystem to "Windows" and using
"WinMain" exactly as the documentation describes.
You need to add the following flag when compiling :
-L/SUBSYSTEM:CONSOLE:4.0
--
/Jacob Carlborg
On 2013-04-20 05:26, Diggory wrote:
- derelict.opengl.gl:
Has all of opengl plus wgl* functions needed for windows, but has more
dependencies than an ideal opengl binding would have.
Dependencies, like what?
--
/Jacob Carlborg
see the change made by "foo".
Don't know if this explanation helped you to understand.
--
/Jacob Carlborg
eadLineW', and then subsequently calling
'toUTF8' after that.
It just seems like something like this would be nice to have in phobos
if it's not already there.
There is a module in Tango for this, tango.io.UnicodeFile
http://dsource.org/projects/tango/docs/current/
https://github.com/SiegeLord/Tango-D2
--
/Jacob Carlborg
On 2013-04-02 16:17, Jacob Carlborg wrote:
Then I should probably report this as an issue.
http://d.puremagic.com/issues/show_bug.cgi?id=9859
--
/Jacob Carlborg
ically)
}
If compiler does not reject escape...
void main()
{
const int[] a = [3, 4, 5];
auto dg = foo(a);
// typeof(dg) == inout(int[]) delegate(inout(int[]))
int[] b = dg([]);
assert(b.ptr == a.ptr); // type-system breaking!
}
Kenji Hara
Then I should probably report this as an issue.
--
/Jacob Carlborg
a single token, it's two.
In general you can have arbitrary amount of whitespace between tokens.
--
/Jacob Carlborg
][2LU])).serializeArray.__lambda2008.__aggr2839
inout variables can only be declared inside inout functions
I can't seem to find any answers in the documentation. Anybody could
help me out?
Fixed in
https://github.com/jacob-carlborg/orange/commit/9c632660db5199640d9aeded098ce359cc5b53e1
--
/
ffers from some large deficiencies.
I had to change to a regular for-loop and declare the element as "const":
for (size_t i = 0; i < arr.length; i++)
{
const e = arr[e];
}
--
/Jacob Carlborg
digitalmars.com
--
/Jacob Carlborg
declared inside inout functions
main.d(9): Error: variable main.foo.__lambda1.e inout variables can only
be declared inside inout functions
If I remove the delegate everything compiles. Am I doing something wrong?
--
/Jacob Carlborg
n unit
test runner that calls "setAssetHandler" before running the tests?
--
/Jacob Carlborg
][2LU])).serializeArray.__lambda2008.__aggr2839
inout variables can only be declared inside inout functions
I can't seem to find any answers in the documentation. Anybody could
help me out?
Seems to be a problem with arrays in base classes. I'm looking into it.
--
/Jacob Carlborg
On 2013-03-27 08:17, Jacob Carlborg wrote:
There's core.demangle, but that won't give you an AST and it will
probably fail in some cases. I would try and modify core.demangle to
produce an AST instead of a string. Perhaps this old project has
something useful:
http://flectioned.kueh
and modify core.demangle to
produce an AST instead of a string. Perhaps this old project has
something useful:
http://flectioned.kuehne.cn/
--
/Jacob Carlborg
suspected that.
--
/Jacob Carlborg
][2LU])).serializeArray.__lambda2008.__aggr2839
inout variables can only be declared inside inout functions
I can't seem to find any answers in the documentation. Anybody could
help me out?
I'll take a look. Which compiler and version are you using?
--
/Jacob Carlborg
On 2013-03-25 23:58, Jonathan Crapuchettes wrote:
Is there a way to get the names of the fields in a named tuple? It looks
like the names are actually aliases.
Perhaps "fieldSpecs".
--
/Jacob Carlborg
the assert before any module constructors run without
hacking druntime?
As a workaround you could try overriding "onAssertError" and/or
"onAssertErrorMsg".
https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L393
--
/Jacob Carlborg
racter" would mean the same
thing in every situation for a given encoding.
--
/Jacob Carlborg
this is a control character, but not according to
std.uni.isControl. This will cause the test suite for the pull request
not to be run since std.json chokes on the DEL character.
https://github.com/D-Programming-Language/phobos/pull/1217
--
/Jacob Carlborg
erelict on Linux because of symbol clashes (e.g. the
function pointer for glClear would clash with the glClear symbol
in the shared lib). Switching to aliased function pointers was
the work around. I will never "get" Linux.
Ok, I see.
--
/Jacob Carlborg
an have a look. Please
add an issue so it's not forgotten.
--
/Jacob Carlborg
On 2013-03-20 14:25, Mike Parker wrote:
Can dstep output function declarations as aliased function pointers in
the format I use in Derelict?
BTW, why does it uses aliases and not declare a function pointer directly?
--
/Jacob Carlborg
/jacob-carlborg/dstep/issues/new
What is "anonymous struct alias replacement"? You can also create issues
for enhancement requests.
--
/Jacob Carlborg
On 2013-03-20 14:25, Mike Parker wrote:
Can dstep output function declarations as aliased function pointers in
the format I use in Derelict?
I guess I could make an option for that.
--
/Jacob Carlborg
7;m glad to see that you found
it useful.
--
/Jacob Carlborg
You need to use TypeTuple and not Tuple. This is my library functions
for UDA's:
https://github.com/jacob-carlborg/orange/blob/master/orange/core/Attribute.d
--
/Jacob Carlborg
nges. Am i missing any function?
There's a function called "topN" in std.algorithm, I don't know if
that's what you're looking for.
http://dlang.org/phobos/std_algorithm.html#topN
--
/Jacob Carlborg
parameter. If a default
parameter is added it needs to be added last, which would result some
somewhat inconsistent order for the parameters. So I vote for a new
overload.
--
/Jacob Carlborg
back from the owned gl thread. But I need the gl Tid to send data
through to the gl thread. Is there a another way to access the gl
thread's Tid from within the main thread?
Not to answer the question but DWT supports OpenGL:
https://github.com/d-widget-toolkit/dwt
--
/Jacob Carlborg
ent/
Tango-D2: https://github.com/SiegeLord/Tango-D2
It's damn fast.
--
/Jacob Carlborg
pport. It has not yet happened. It's all about time.
--
/Jacob Carlborg
64bit cannot. DWT was started quite long
ago, when more people used 32bit platforms.
--
/Jacob Carlborg
On 2013-02-28 21:38, rho wrote:
do all those work with x64? are they complete?
are all tools to build the libs on board the standard D distro?
DWT does not work on 64bit. You can run 32bit applications on 64bit systems.
--
/Jacob Carlborg
On 2013-02-28 10:35, rho wrote:
hi,
what keeps me from using d, is that there is no compilable gui lib
available. does dfl compile with the latest dmd?
DWT: https://github.com/d-widget-toolkit/dwt
--
/Jacob Carlborg
of give it back to the OS.
--
/Jacob Carlborg
licit.
Some things to take into consideration:
* The GC will always allocate in chunks and may therefore use more than
expected memory
* The GC will never give back memory to the OS which it has allocated
--
/Jacob Carlborg
se
provide information about the whole application, instead of the specific
class instance. Simple size calculation of class fields doesn't
correspond to memory consumption.
An object will contain some hidden members as well. Try this:
http://dlang.org/traits.html#classInstanceSize
--
/Jacob Carlborg
e me, a
Chinese user, a lot Chinese characters namd dirs on my PC, ACP is
936--GBK), it fails. Better way is to use GetModuleFileNameW and wchar[]
then convert back to char[].
Anyway, thank you very much!
Yeah, GetModuleFileNameW should be used. I'm pretty sure the other
platforms will
but I think as a common task there
should be a platform-independent way to get it in the standard library.
http://www.dsource.org/projects/tango/attachment/ticket/1536/process.d
--
/Jacob Carlborg
know are meant to be volatile.
Hope that helps :)
If you're interfacing with C you should just remove the volatile
statement/keyword.
"There is no volatile type modifier in D. To declare a C function that
uses volatile, just drop the keyword from the declaration."
http://dlang.org/interfaceToC.html
--
/Jacob Carlborg
te mixins that could help:
http://dlang.org/template-mixin.html
--
/Jacob Carlborg
On 2013-02-16 15:12, Ali Çehreli wrote:
I don't think it is better than any other solution. I got reminded of
this possibility; that's all. :)
Fair enough. :)
--
/Jacob Carlborg
On 2013-02-16 05:14, Ali Çehreli wrote:
mixin (import ("part_of_my_module.d"));
mixin (import ("another_part_of_my_module.d"));
How is that better than public imports. You'll get access to private
declarations but besides that.
--
/Jacob Carlborg
On 2013-02-15 12:04, Colin Grogan wrote:
Ah ok, now I get it.
Note that in Java you declare a package wheres in D you declare a module.
If you have something like this in Java:
// Baz.java
package bar.foo;
You would do this in D:
// Baz.d
module bar.foo.Baz;
--
/Jacob Carlborg
t overload sets. Try:
alias Foo.foo foo;
http://dlang.org/template-mixin.html
Search for: "Mixin Scope" and pay attention to:
"Alias declarations can be used to overload together functions declared
in different mixins".
--
/Jacob Carlborg
. You need
to bring in "foo" from the base class into the overload set in the
subclass. You can do this by using an alias:
class B : A
{
alias A.foo foo;
}
--
/Jacob Carlborg
On 2013-02-08 00:41, deed wrote:
Input regaridng DWT with phobos is welcome. See posting here:
http://forum.dlang.org/thread/otyfilaasbxrwnqvr...@forum.dlang.org
I've answered in the DWT newsgroup.
--
/Jacob Carlborg
the array with something more typed,
if possible.
--
/Jacob Carlborg
27;s Unicode. It will of course not validate the Unicode.
--
/Jacob Carlborg
;
bar.gun();
foo.Received().fun(); // pass if 'fun' was called
}
void main() {}
The syntax for template instantiation is:
auto foo = new Mock!(IFoo)();
--
/Jacob Carlborg
}
}
You can still change the "foo_" variable.
--
/Jacob Carlborg
C++.
Are both the D and C++ code compiled for the same architecture?
--
/Jacob Carlborg
already on the first go and other questions, like if
all functions should be marked nothrow for example.
There's a tool, DStep, that can automatically translate C headers to D
modules. It will require some manual adjustments, like adding imports:
https://github.com/jacob-carlborg/dstep
asses, are references.
There are dynamic arrays and static arrays. Dynamic arrays are reference
types, static arrays are value types. You have declared a static array.
http://dlang.org/arrays.html
--
/Jacob Carlborg
and submit to Phobos?
--
/Jacob Carlborg
On 2013-01-24 15:43, Maxim Fomin wrote:
Even if Singleton.instance returns by ref, s object is still
stack-allocated struct, which is not affected by further modification of
private pointer.
The struct is allocated using "new".
--
/Jacob Carlborg
One work around is to use 'system' (under std.process).
I don't think Phobos currently has any functions for this. Someone
posted code in these newsgroups of a parallel implementation of copy and
remove.
--
/Jacob Carlborg
ong)
It means that the test suite failed. You can click "Details" to get more
details about what failed.
--
/Jacob Carlborg
n compiling the application,
then you'll get undefined symbols:
"_D3foo3Foo7__ClassZ"
--
/Jacob Carlborg
he
use case you have here and separate compilation.
I guess you would need to list the fields on classes/structs, again
that's just like C++.
--
/Jacob Carlborg
On 2013-01-17 08:20, Era Scarecrow wrote:
Oh yes, do UDA's only work on types? or do they work on
functions/methods/delegates too? If you have it on a function how could
that be useful?
You can basically attach an UDA to any declaration. I think the
exception is parameters.
--
/
901 - 1000 of 1682 matches
Mail list logo