d you still could shoot yourself in the leg, but only explicitly (that
is "Foo f = Foo(42)" ) and only in the same module.
--
Dmitry Olshansky
StringW( cast(LPCWSTR)s, cast(LPWSTR)null, 0,
cast(HANDLE)0 );
changing that to more accurate:
return mciSendStringW(toUTF16z(s) , cast(LPWSTR)null, 0, cast(HANDLE)0 );
works for me, even with this name:
snd\와카미야 온마쓰리.mp3
If you use W version you need to re-encode your UTF8 string to UTF16.
AFAIK
= xs;
}
}
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
Tuple!(X) from std.typecons should do
--
Dmitry Olshansky
bugs may happen...
(There are ten different better ways to write that program, but this is not the
point).
Bye,
bearophile
--
Dmitry Olshansky
x27;s more clear how array is changed.
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
--
Dmitry Olshansky
On 19.11.2010 17:53, Dmitry Olshansky wrote:
On 19.11.2010 16:11, spir wrote:
Hello,
* What is the D-idiomatic way to remove an element from a dynamic array?
* Ditto, for a slice, but with the 2 variants expression vs statement:
a.removeSlice(i1, i2);
That would most likely be:
std.array
:00405AAC calledx ;< note the indirect call
_TEXT:00405AAE pop ebx
_TEXT:00405AAF leave
_TEXT:00405AB0 retn 8
That's as far as I can get for now, there is still room for investigation.
--
Dmitry Olshansky
l which aims to replace toString
with more eficient and flexible function (and was generally accepted):
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP9
--
Dmitry Olshansky
aybe a
simple ray tracer. Don't have anything planned out yet, But whatever,
I can think ahead later! Hope you find my video useful.
--
Dmitry Olshansky
et a new struct to
void changing (in a unnoticeable way) the same struct i just set.
thanks.
g g
--
Dmitry Olshansky
args in place of ...
if Node has a constructor, or just
Node* x = new Node;// if no constructors
--
Dmitry Olshansky
rror: obviously shouldn't work since a6
could then be used to break the
// UniqueArray contract
}
What do you think?
--
Atenciosamente / Sincerely,
Guilherme ("n2liquid") Vieira
--
Dmitry Olshansky
On 09.01.2011 1:43, bearophile wrote:
In D the name of functions starts with lowercase.
Or more precisely, in Phobos.
There is no such requirement in D, I may suggest you stop using such a
general and assertive posts, so not to confuse anyone.
--
Dmitry Olshansky
signature was void bar(ref FooX) then it should have failed.
But the third makes me wonder what the *** is going on.
--
Dmitry Olshansky
On 23.01.2011 19:05, Mafi wrote:
Am 23.01.2011 11:00, schrieb Dmitry Olshansky:
On 23.01.2011 2:02, bearophile wrote:
Is this another compiler bug?
The situation is nice:
struct Foo1 {}
struct Foo2 { int x; }
const struct Foo3 { int* p; }
struct Foo4 { int* p; }
void bar1(Foo1 f) {}
void
ent interfaces (no occasional Object ). The
workaround would be to inherit all your interfaces from
a common base like:
interface Base{}
interface A: Base{...}
interface B: Base{...}
class CA: A{.. }
Base[] pile;
pile ~= new CA();
Bye,
bearophile
Thanks
Mandeep
--
Dmitry Olshansky
**uk is going on I suggest
to wrap suspicious code with :
try{
... //code
}catch(Exception e){
writeln(e);
}
to see what's the errors are.
with lone "*" in regexp output would be :
object.Exception: *+? not allowed in atom
not very detailed perhaps but gives a hint ;)
--
Dmitry Olshansky
21]
Should not a class invariant apply to properties, too?
Kind regards
Michael
--
Dmitry Olshansky
On 16.02.2011 20:47, Jesse Phillips wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natural assign syntax like
idered as bug as it is far
from obvious, at least from my point of view.
It looks like the manifestation of
http://d.puremagic.com/issues/show_bug.cgi?id=3516
vote up ! ;)
--
Dmitry Olshansky
best way to OpenGL and such in D, because of
the nice way it loads & handles all these weirdness with loading, say,
OpenGL extensions. And automatically picking up any suitable shared lib
is big win.
Anyway, any help would be appreciated,
Thanks.
Sadly your file goes like rubbish for me, is that base64 ?
--
Dmitry Olshansky
_hdc = hdc;
}
@property HDC getHandle(){ return _hdc; }
private:
HDC _hdc;
}
uinttest{
HDC h = cast(HDC)1;
canvas c = h;//intitalize
h = c;
assert(h == c);
}
--
Dmitry Olshansky
On 23.02.2011 21:48, Simon wrote:
On 23/02/2011 18:42, Simon wrote:
On 23/02/2011 14:37, Dmitry Olshansky wrote:
On 23.02.2011 17:08, %u wrote:
Hi everyone,
Was hoping someone could help me make sense of this bit of C++ code:
class canvas
{
operator HDC() { return _hdc; }
protected:
canvas
result ~= to!string(data[$-1]);
result ~= ')';
return result;
}
alias data this;
}
Usage:
void main(){
Numbers nums = Numbers([1.1,2.2,3.3]);
writefln("%s",nums);
nums[0] = 4.4;
writefln("%s",nums);
}
--
Dmitry Olshansky
0x0001b12b main + 179
21 test 0x2101 start + 53
--
Dmitry Olshansky
On 26.02.2011 19:52, Jacob Carlborg wrote:
On 2011-02-26 12:29, Dmitry Olshansky wrote:
On 26.02.2011 14:10, Jacob Carlborg wrote:
I'm trying to use the std.regex module but when I run my application I
get an exception. The exception message says:
*+? not allowed in atom
The code I ha
nges in Phobos.
So you should check m.empty before use.
P.S. I'm in the process of patching in lookahead regexes, I think I can
get them fairly soon. As for lookbehind, well, that's would be somewhat
harder it seems.
--
Dmitry Olshansky
On 27.02.2011 13:41, Jacob Carlborg wrote:
On 2011-02-26 19:49, Dmitry Olshansky wrote:
On 26.02.2011 19:52, Jacob Carlborg wrote:
On 2011-02-26 12:29, Dmitry Olshansky wrote:
On 26.02.2011 14:10, Jacob Carlborg wrote:
I'm trying to use the std.regex module but when I run my
applicat
e second to "height"
Now speaking of it's implementation - it's quite broken.
The relevant bug report is
http://d.puremagic.com/issues/show_bug.cgi?id=3474 (vote up!)
Still it's not considered to be a critical one, since you can workaround
it by:
img[img.width-1,img.height-1] = lastValue;
--
Dmitry Olshansky
//www.digitalmars.com/d/2.0/phobos/std_algorithm.html#sort
--
Dmitry Olshansky
On 19.04.2011 16:56, Dmitry Olshansky wrote:
If you are talking use std.algorithm sort
Should be: "If your are talking about D2, then use std.algorithm sort
", ouch :)
--
Dmitry Olshansky
s1 =", abc, de, fg, hi,";
assert(equal(splitter(s1, regex(", *")),
["","abc","de","fg","hi",""][]))
Simply put it gets you range of slices of input separated by regex matches.
Since I'm not very familiar with ranges, am I missing some obvious way
of doing this with the existing .pre, .hit and .post properties?
-Dave
--
Dmitry Olshansky
for any range in std.range, try
inputRangeObject & outputRangeObject. Every such range object is derived
from the most suitable interface InputRange, ForwardRange etc.
--
Dmitry Olshansky
and then use only the lower 8 or 16 bits of
the result. You can
>assume that the type conversion takes zero or one clock cycle. In
64-bit systems, there is
>only a minimal difference between the efficiency of 32-bit integers
and 64-bit integers, as
>long as you are not doing divisions.
--
Dmitry Olshansky
ccess private members of the class in the same module.
There are some known bugs about it:
http://d.puremagic.com/issues/show_bug.cgi?id=3108
<http://d.puremagic.com/issues/show_bug.cgi?id=314>
--
Dmitry Olshansky
Test;
Test t = new Test;
t.test(); /*ok*/
t.testNonTemplate(); /*error*/
writeln(t.getX()); /* prints 100 */
I am using dmd 2.052
Then it's definitely a bug, it might be a duplicate report but it I
suggest to file it anyway.
It sill fails on my almost newest DMD from github.
--
Dmitry Olshansky
r I think the reason is in your's Vector's operator +
overloading which expects ref Vector parameter it seems, though you'd
better provide this function code as well.
--
Dmitry Olshansky
uE0nIwbk
Limitations are caused by bug, that is going to get fixed eventually ;)
--
Dmitry Olshansky
On 01.05.2011 19:31, Peter Alexander wrote:
On 1/05/11 2:53 PM, Dmitry Olshansky wrote:
Ehm.. Well, first things first: you shouldn't use classes for
lightweight & plain data things like vectors. There are structs for
that. In general, structs are value-like objects living on the st
t the interfaces defined like that in std.range?
One reason might be is that it was implemented under worse compiler
condition ;)
Seems worthy of a bug report, or better yet a pull request.
--
Dmitry Olshansky
tester first ;)
http://d.puremagic.com/test-results/
--
Dmitry Olshansky
p.exe: cannot create regular file `\dmd2\windows\lib':
No such file or directory
Replacing cp with 'copy' doesn't work either, since copy uses a different
syntax.
I'm not seeing a CP binary in any of the DigitalMars tools.
Yup, overall win32 makefile seems horribly f**ed up.
--
Dmitry Olshansky
and debug builds and all modules one by one).
--
Dmitry Olshansky
ked very deep. One reason
is that win32 had a collection of workarounds for optlink. And that not
counting the sheer verbosity of it.
Me thinks that if anyone has the skill to bring to shape win32 makefile
that would make an awesome pull request.
--
Dmitry Olshansky
s calling destroySocket in next)
but you get your index still incremented (next returns true) so it will
point out of array and it won't be equal to reads.length on next step.
Try adjusting that == to >= on line 60 to test this theory.
--
Dmitry Olshansky
Regarding the glue code, it is currently maintained by Iain alone. He
tends to be quite active though.
Right and I've seen this cool option 'use other compiler' in recent
VisualD with textbox for command line. So GDC & LDC support is almost there.
OT: You are R&D and still use Windoze? ;)
--
Dmitry Olshansky
On 30.05.2011 19:14, Jeff Slutter wrote:
On 5/30/2011 10:57 AM, Dmitry Olshansky wrote:
It was me who brought it Unilink out of infernal abyss :) See also:
http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html
Seriously I still suggest to try it
em out anyway):
array.countUntil!"a == b"(element); //same as default
array.countUntil(element);
another one:
removeAt(index);
should be array.removeAt(index) or removeAt(array, index);
And last but not least there is remove in Phobos, it's just link to it
from summary table is constantly getting screwed up.
--
Dmitry Olshansky
void[])
===
mmm.. strangely enough the code below succeed!
void removeAt(T)(ref T[] array, int index)
{
if(index < 0 || index >= array.length)
return;
T[] empty;
array.replaceInPlace(index, index + 1, empty);
}
but T[].init didn't work either?! ho well, thanks! :)
--
Dmitry Olshansky
hus could be integrated with D projects slightly
better. Still if you are up for some hacking give it a try.
As for speed, yeah, it's something like around 20-200x slower at various
workloads (e.g. numerics in JavaScript and such), so wouldn't recommend
if you have performance in mind.
--
Dmitry Olshansky
linker symbols on linux recently, in the end I
had to rebuild dmd, druntime & phobos from the latest git master.
--
Dmitry Olshansky
But that just blows up in my face.
std.encoding to the rescue?
It looks like a well established module that was forgotten for some reason.
And here I'm wondering what a function named sanitize could do :)
--
Dmitry Olshansky
On 26.06.2011 3:25, Nick Sabalausky wrote:
"Dmitry Olshansky" wrote in message
news:iu5n32$2vjd$1...@digitalmars.com...
On 26.06.2011 1:49, Nick Sabalausky wrote:
"Andrej Mitrovic" wrote in message
news:mailman.1215.1309019944.14074.digitalmars-d-le...@puremagic.com...
ht of something more like tag based file system, where
filetypes and e.g. date of modification are just that - one of myriad
of tags, besides any additional that are user/system defined.
Though I have never reached any more or less complete design, the idea
still thrills me.
--
Dmitry Olshansky
.ext";
std.regex�is�std.regexp's�replacement.
-�Jonathan�M�davis
--
Dmitry Olshansky
e)
{
auto onlyDigitis = array(filter!((x){ return !isWhite(x);
})(line)); // this copies all digits to a new array
auto result = find(onlyDigits, ... ); //your query here
///
}
Thanks
--
Dmitry Olshansky
On 17.07.2011 0:41, Willy Martinez wrote:
== Quote from Dmitry Olshansky (dmitry.o...@gmail.com)'s article
If you wish to avoid storing all of this in an array by using e.g.
filter _and_ use Boyer-Moore search on it then: No, you can't do that.
The reason is that filter is ForwardRan
On 17.07.2011 1:28, Johann MacDonagh wrote:
On 7/16/2011 5:07 PM, Dmitry Olshansky wrote:
Let's drill down to the problem through this barrage of crap:
the problem statement is
Error: cannot implicitly convert expression (haystack) of type dchar[]
to string
So (apparently) the probl
indows" to update my dbghelp.dll
- I'm already compiling/linking in one step, and using -g (also tried -gc)
- I tried running the executable through cv2pdb.
None of it's working.
Last time I've seen stack trace it was due to this command:
dmd -debug -g ...
--
Dmitry Olshansky
~
concatenate complie-time string for 0 overhead.
After all, hardcoded strings are not exactly good thing in the first place.
For big formatted texts just use string import :
writeln(import("usage.txt"));
work like a charm.
So IMHO it's a non-issue.
--
Dmitry Olshansky
On 22.07.2011 15:02, Nick Sabalausky wrote:
"Dmitry Olshansky" wrote in message
news:j0bgt7$176q$1...@digitalmars.com...
On 22.07.2011 6:54, Nick Sabalausky wrote:
I'm not getting any of the function names on the stack traces.
I tried everything I found in here:
http://www.di
Gh # Import by ordinal, strip unused PE headers
-LC:\DMD2\Windows\LIB
-zkernel32;advapi32;user32;wsock32;shell32;snn;phobos
-Go
--
Dmitry Olshansky
t somebody will hit this anytime soon, so
now I might roll out a pull request sooner :)
--
Dmitry Olshansky
://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx
Hmm I guess I must have forgotten to re-try the cv2pdb trick after I updated
dbghelp.dll. That works now. Thanks.
Any idea why this trick is needed? For me it works as is, just wondering...
--
Dmitry Olshansky
On 25.07.2011 13:59, Kagamin wrote:
Dmitry Olshansky Wrote:
Any idea why this trick is needed? For me it works as is, just wondering...
Your dbghelp probably recognizes the old CV format.
In case anybody wants to check this, my dbghelp.dll is here:
http://dl.dropbox.com/u/7100999/dbghelp.7z
ou configured it correctly (should be straightforward,
there are examples)
--
Dmitry Olshansky
L, it shouldn't be usually.
It's possible in case if, for instance, your first version uses more
different functions from lib then the second one, in effect linker could
pull in less object files from library.
--
Dmitry Olshansky
On 27.07.2011 23:35, simendsjo wrote:
On 27.07.2011 20:59, q66 wrote:
== Quote from Dmitry Olshansky (dmitry.o...@gmail.com)'s article
On 27.07.2011 15:21, simendsjo wrote:
A simple hello world like dfl application takes 1.2mb. Upx does a
great job packing this to 200k, but I wonder if
On 27.07.2011 21:16, simendsjo wrote:
On 27.07.2011 15:45, Dmitry Olshansky wrote:
On 27.07.2011 15:21, simendsjo wrote:
A simple hello world like dfl application takes 1.2mb. Upx does a
great job packing this to 200k, but I wonder if there is a way to make
optlink generate smaller executables
On 28.07.2011 2:03, simendsjo wrote:
On 27.07.2011 23:00, Dmitry Olshansky wrote:
On 27.07.2011 21:16, simendsjo wrote:
On 27.07.2011 15:45, Dmitry Olshansky wrote:
On 27.07.2011 15:21, simendsjo wrote:
A simple hello world like dfl application takes 1.2mb. Upx does a
great job packing this
.algorithm, std.stdio, std.range;
void main()
{
Xorshift rng;
rng.seed(unpredictableSeed);
writeln(take(rng, 10));
}
--
Dmitry Olshansky
p; STL
extensively I would find this line a very simple and clean solution. Now
time is changing and so on...
A thought - would amap as a shorthand for array(map... float your boat?
One pair of parens off.
--
Dmitry Olshansky
guous?
import std.traits;
struct S {
this(uint i) {}
this(C)(C c) if(isSomeChar!C) {}
}
void main() {}
struct S {
this()(uint i) {}
this(C)(C c) if(isSomeChar!C) {}
}
should do it, though it (and workaround) looks like a bug to me.
--
Dmitry Olshansky
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
"Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)"
Is this because char etc can be co
generic code would totally expect
slice to
1. return the same type as the range itself (or 100% compatible)
2. most of the time not to allocate
--
Dmitry Olshansky
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
"Error: template t.S.__ctor(C) if(isSomeCh
On 02.08.2011 16:30, simendsjo wrote:
On 02.08.2011 14:22, Dmitry Olshansky wrote:
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The
it has been initialized, but an empty string is
also a valid value. Because I shouldn't check for null, I now have to
add another field to the struct to see if the array has been
initialized. This feels like a really suboptimal solution.
length works even for "null" arrays and returns 0. Even cleaner way is
to use std.array.empty:
char[] abc = null;
assert(abc.empty);
So there is no uninitialized arrays, there are just different versions
of empty slices.
--
Dmitry Olshansky
ntly dsicovered (and
fixed) bug with OSX Lion, more info here:
https://github.com/D-Programming-Language/druntime/pull/42
At any rate it's going to be into the next release, other then waiting
for it you can manually build latest dmd/druntime from github.
--
Dmitry Olshansky
Just lost the best part of an hour figuring the cause of this small
problem, consider:
void main()
{
uint j = 42;
ulong k = 1<I though left operand should be promoted to the largest integer in shift
expression, isn't it?
--
Dmitry Olshansky
mmetric in nature so it really shouldn't do any promotions.
Sorry for the noise.
--
Dmitry Olshansky
On 08.08.2011 2:07, bearophile wrote:
Dmitry Olshansky:
Sorry for the noise.
It's not noise, and you don't need to be sorry, in my opinion it's a D/DMD
design fault. Clang gives an error on code like that:
http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html
See the
roblem anyway?
Your case seems simple, it means you can't index tuple with variable as
index, only with something known at compile time.
Replace auto with enum and you are fine, you can even call a function
using CTFE to get an index.
--
Dmitry Olshansky
e folks had trouble linking gtkD library with it.
--
Dmitry Olshansky
ot;a label");
}
}
Label doesn't affect switch statement in any way, e.g. it's not part of
case x: synatx, and as such is "fallthrough" like in normal code.
So this part works as intended, though I agree with bearophile there are
some messy things w.r.t. switch.
--
Dmitry Olshansky
t a fall through
error on this code?
Have you run that code?
Bye,
bearophile
--
Dmitry Olshansky
overflowed "negative" lengths. Maybe we can put it here as
unsafe and fast version though.
Also check std.utf.stride to see if you can get it better, it's the
beast behind narrow string popFront.
--
Dmitry Olshansky
really depends on what the compiler does.
>
Yes and no, I think it would be hard to find app that bottlenecks at
traversing UTF, on decoding - maybe. Generally if you do a lot calls to
stride it's in cache, if not it doesn't matter much(?). Though I'd
prefer non-tabulated version
In any case, this may not improve walkLength by more than a few
percents.
Then specializing walkLength to do your unrollable version seems like
good idea.
--
Dmitry Olshansky
for (int i = 1; i< array.length; ++i) {
end.tail_ = new Cons!T(array[i], null);
end = end.tail_;
}
return result;
}
If I'm not mistaken only strongly pure functions are working.
--
Dmitry Olshansky
ameters or something. Last
summer I actually wrote a Replace template to scratch that itch. dmd
choked on it pretty quickly too.
--
Dmitry Olshansky
lace your bet on a few prime features (e.g. 3 like in one of Andrei
talk). And then you can casually present a short list of other cool
features and say a thing or two about them, not forgetting that there is
even more.
--
Dmitry Olshansky
7;s the case
- define sane opEquals*:
bool opEquals(in S s)const{
return str == t.str;
}
* I haven't followed the timeline of the changes to opEquals that
ultimately made things much simpler so you may have to rewrite it as
bool opEquals(const ref S s)const in dmd 2.055.
--
Dmitry Olshansky
ould this be
correct? Or would this be too much?
isRandomAccessRange && !isFiniteRange && isBidirectionalRange && hasSlicing
isRandomAccessRange should be enough. Also why !isFinite how would one
sort infinite range? hasSlicing is needed though. So my take on this
would be:
isRandomAccessRange && hasSlicing
--
Dmitry Olshansky
her stuff you'd use range, like you'd use
iterators in c++. Range gets stack/register allocated pointers directly
to data (or close to it, that depends on container) so the only extra
cost in reference type compared to value is the first indirect access to
construct range and it's negligible.
--
Dmitry Olshansky
On 24.10.2011 5:57, Sean Silva wrote:
== Quote from Dmitry Olshansky (dmitry.o...@gmail.com)'s article
Less efficient is a moot point.
When you do iteration and other stuff you'd use range, like you'd
use
iterators in c++. Range gets stack/register allocated pointers
direct
remove() doesn't work in-place, I think this is a bug or a design
bug.
Bye,
bearophile
No, it's not a bug. It's the same as c++ STL remove - it operates on
range but not on container. To shrink container, update it's length.
--
Dmitry Olshansky
no output - WTF? Ahem, it just called that command line tool named test...
sh$: ./test
wow, now something happens ;)
--
Dmitry Olshansky
gant. But it is what people want to
do and it should not be any harder than necessary.
You still can, just use plain range interface with empty/front/popFront.
for(auto r = list[]; !r.empty; r.popFront())
{
...
}
--
Dmitry Olshansky
On 31.10.2011 18:38, Steven Schveighoffer wrote:
On Mon, 31 Oct 2011 05:16:11 -0400, Dmitry Olshansky
wrote:
On 31.10.2011 11:16, Tobias Pankrath wrote:
Jonathan M Davis wrote:
find allows
you to do that just fine, and such a remove function would simply be
duplicating its functionality
passed to remove that it does belong to this list. (i.e. it walks
from head till hits it or it's own tail)
--
Dmitry Olshansky
1 - 100 of 502 matches
Mail list logo