On 07/09/2016 10:32 PM, phant0m wrote:
As far as I know, AA implemented as a hashtable. So, will there be two
searches performed (one search for each line)?
records[3].value = 10;
records[3].name = "name";
Yup. A good optimizer may be able to eliminate one, but conceptually
there are two
On 07/09/2016 12:33 AM, jmh530 wrote:
I'm trying to create a tuple of variadic length containing structs with
mixed types. So for instance, given
struct Foo(T, U)
{
T x;
U y;
}
I want to create something like
Tuple!(Foo!(type1, type2), Foo!(type1, type3), ..., Foo!(type1, typeN)) x;
On 07/07/2016 12:33 PM, Basile B. wrote:
Do you think it's a bug ?
Yes.
On 07/05/2016 08:16 PM, Charles Hixson via Digitalmars-d-learn wrote:
What I'm looking for is the opposite of the "FromUnixTime" function.
That would be the "toUnixTime" method then, I suppose.
https://dlang.org/phobos/std_datetime.html#.SysTime.toUnixTime
On 07/05/2016 07:25 AM, ketmar wrote:
cast `shared` away. yes, this is how you supposed to use it now: cast it
away.
after having ensured thread safety that is
On 07/05/2016 12:47 PM, Jack Applegame wrote:
ttt.d
import std.string;
void main() {
lastIndexOf("aa","bb");
}
rdmd ttt.d
compiles successfully without any errors or warnings
rdmd -dw ttt.d
compiles successfully without any errors or warnings
rdmd -de ttt.d
On 07/04/2016 07:16 AM, Hiemlick Hiemlicker wrote:
But static isn't per instance, is it?
Sure isn't. __gshared isn't either.
That means every thread created will have the same value of Paused.
Calling Pause will pause all threads. That can't be right.
I don't know what exactly you're doing
On 07/04/2016 01:20 AM, Hiemlick Hiemlicker wrote:
I have thread. It locks up. If I changed from a bool val it is using
from shared to __gshared it works. I checked the address inside and
outside of the thread and they are different for shared and same for
__gshared.
[...]
shared bool
On 07/04/2016 12:00 AM, MMJones wrote:
I like the term var better than auto. Is there a way to alias auto?
no
On 07/01/2016 12:35 PM, Nordlöw wrote:
What's the preferred way of reacting to emptyness in the members front,
back, popFront, popBack --- using assert, enforce, throw, or simply
relying on range-checking in the _store?
I think assert is the most common way of checking. Simply ignoring the
On 06/30/2016 04:39 AM, JS wrote:
struct EnumToFlags(alias E)
{
import std.traits, std.conv, std.string, std.algorithm, std.array;
static if (E.max < 8)
alias vtype = ubyte;
Convention says: Capitalize user-defined type names. So it should be
"Vtype" or maybe "VType"
On 06/29/2016 08:59 PM, jmh530 wrote:
For instance, in the bar function below, I have to
explicitly instantiate the inner function template.
[...]
template bar(T)
{
T bar(U)(T x, U y)
{
return x + cast(T)y;
}
}
void main()
{
int a = 1;
long b = 2;
On 06/29/2016 07:00 PM, Guido wrote:
On another topic, tuples seem to have a major problem as well.
Tuple!(float, float, float) test;
Tuple!(float, float, float) [] array_data;
test[0] = 1.0; // works
array_data[i][0] = 1.0; // doesn't work.
Works just fine for me, if I add the missing
On 06/26/2016 05:37 PM, Smoke Adams wrote:
system("cls") works but executeShell doesn't. system is depreciated.
Unsolicited spelling correction: no 'i' in "deprecated".
What's going on? The docs say that it creates a new process. I simply
want to clear the console!
`system` directly prints
On 06/21/2016 10:48 PM, Lodovico Giaretta wrote:
struct Wrapper(T)
{
private T wrapped;
template hasAssignableProperty(string name, Arg)
{
enum bool hasAssignableProperty = is(typeof(
(ref T val, ref Arg arg)
{
On 06/20/2016 11:33 PM, Joerg Joergonson wrote:
On Monday, 20 June 2016 at 10:38:12 UTC, ag0aep6g wrote:
[...]
Is your position that Button!SliderItem should derive/inherit from
Button!ButtonItem, enabling the cast, or do you suppose the cast
should succeed because the fields are compatible?
On 06/20/2016 01:40 AM, Joerg Joergonson wrote:
public class Button(T : ButtonItem) : Widget { ... }
public class ButtonItem : Item
{
void Do() { auto parent = (cast(Button!ButtonItem)this.Parent); }
...
}
All this works great! As long as Do is not being called from a derived
class
public
On 06/19/2016 11:19 PM, Joerg Joergonson wrote:
On Sunday, 19 June 2016 at 20:21:35 UTC, ag0aep6g wrote:
[...]
No. B!b is derived from A!b, not from A!a. `b` being derived from `a`
does not make A!b derived from A!a.
why not? This doesn't seem logical!
Template parameters simply don't work
On 06/19/2016 09:59 PM, Joerg Joergonson wrote:
This should be completely valid since B!T' obviously derives from A!T
directly
ok
and we see that T' derives from b which derives from a
directly.
ok
So B!b is an entirely derived from A!a
No. B!b is derived from A!b, not from A!a. `b`
On 06/19/2016 12:45 PM, Gary Willoughby wrote:
On Sunday, 19 June 2016 at 10:35:59 UTC, Gary Willoughby wrote:
...
A more correct example:
import core.stdc.stdlib;
import std.traits;
ref T foo(T)()
{
alias Type = Unqual!(T);
Type* foo = cast(Type*) malloc(Type.sizeof * 8);
On Saturday, 18 June 2016 at 17:02:40 UTC, Joerg Joergonson wrote:
3. can't use canFind from algorithm. Complains it can't find a
matching case. I tried many variations to get this to work.
canFind takes a range. Array isn't a range itself, but you can
get one by slicing it with []:
On 06/18/2016 04:37 PM, Gary Willoughby wrote:
Here I'm testing T is either a class or interface:
void foo(T)(T bar) if (is(T == class) || is(T == interface))
{
...
}
Is there a more elegant way of testing T for multiple types? Because it
doesn't scale well if I need to add more.
I would
On 06/11/2016 01:59 PM, yawniek wrote:
i forgot to add a few important points:
- the strings in vec_t are not c strings
- vec_t might contain other data than strings
the original ctor i pasted actually doesn't even work, temporarly i
solved it like
this(string s) {
char[] si =
On 06/08/2016 12:02 AM, cy wrote:
import std.stdio;
void foo(Callable)(Callable bar) {
bar();
}
void foo2(Callable)(Callable bar, int baz) {
bar(baz);
}
void main() {
foo({
writeln("okay");
});
foo2((bar) {
writeln("got",bar);
},42);
foo2((bar) =>
On 06/07/2016 08:50 PM, ParticlePeter wrote:
On Tuesday, 7 June 2016 at 14:31:40 UTC, Alex Parrill wrote:
I don't think opCast gets called for implicit conversions; it only
gets called for explicit casts. I'll test it later.
It does for type bool, but I fear that's the only exception.
No,
On 06/06/2016 11:25 PM, Alex Parrill wrote:
You might be able to get away with casting the const away, if you are
sure it won't modify the hash or equality check.
Casting away const and then mutating has undefined behavior. The
compiler is free to assume that it doesn't happen.
Be aware
On 06/05/2016 08:02 PM, Suliman wrote:
I really can't understand why try-catch block do not handle exception.
digit 1 is printing, so exception is accrue after it, but why nothing in
catch block?
http://img.ctrlv.in/img/16/06/05/57546861d8e81.png
Here is my code:
void dbSetup()
{
try
On 06/04/2016 05:02 PM, chmike wrote:
Is it possible to instantiate immutable objects by using emplace
Yes. I'm not sure, but the memory may have to be untyped for the emplace
call to avoid mutating immutable data. I.e., call emplace with void[],
not with a pointer whose target is already
On 06/03/2016 10:06 PM, chmike wrote:
If I have a static immutable object, I don't have to declare it as
shared because it is implicit. Right ?
Right.
[...]
1. question
---
I had a __gshared Info[N] infos_; that I fill in a static this() method.
Should be filling it in a `shared
On 06/03/2016 04:34 PM, John Nixon wrote:
import std.stdio;
import std.container;
struct CS{
char[] t;
CS dup()const{
CS cs;
cs.t = this.t.dup;
return cs;}
};
Aside: No semicolon after struct declarations in D.
void main(){
Array!CS cs_array = make!(Array!CS)();
On 06/03/2016 01:35 AM, ag0aep6g wrote:
The alternative `peek` method is not documented to throw an exception,
but it's not @nogc either. No idea why. Maybe Algebraic does GC
allocations internally. I wouldn't know for what, though. Or it misses a
@nogc somewhere.
I've looked at the source to
On 06/03/2016 01:17 AM, Alex wrote:
But still, I can't mark the f-method @nogc, and this is not due to the
writeln calls... why GC is invoked, although everything is known and no
memory allocation should happen?
It's the Algebraic. The `get` method isn't @nogc. The documentation [1]
says that
On 06/02/2016 11:37 PM, Alex wrote:
Just tried this instead of your f-function:
void f(int[] arr)
{
A result;
import std.meta;
alias TL = AliasSeq!(Empty, int, Many!int);
int caseS;
switch (arr.length)
{
case 0: result = Empty.init; caseS = 0; break;
On 06/02/2016 10:11 PM, Alex wrote:
The cool thing about the Algebraic is as I expected, that it doesn't
change it's type... And the hard thing is, that I'm not used to its
Empty, Many, ... things yet.
I just made those up on the spot. Note that Many is not actually
implemented at all. There
On 06/02/2016 05:16 PM, Alex wrote:
What I mean is: if there would be a possibility to use algebraic types
here (or maybe some kind of template...), then my types would be able
(maybe! did not seen anything similar yet...) to choose the proper
methods for themselves automatically:
As long as my
On 06/02/2016 04:59 PM, Ali Çehreli wrote:
'alias this' with property functions work at least for your example:
struct FixedRangeInt {
int min;
int max;
int i_;
int value() const {
return i_;
}
void value(int i) {
assert(i >= min);
On 06/02/2016 03:37 PM, Alex wrote:
The question is, how to define the same thing for ranges. What I started
with is:
import std.range : iota;
alias MrSlice = typeof(iota(M.init));
so far, so good. The MrSlice-thing is the analogy for Mr, as it can be
empty, as Mr can.
What I also need is the
On 05/29/2016 10:40 PM, qznc wrote:
bool string_cmp_opt(immutable(ubyte)[] x, immutable(ubyte)[] y) {
Having "string" in the function name may be a bit misleading. This
doesn't have any special functionality for text/characters/Unicode, does it?
Should have const parameters, not immutable.
On 05/28/2016 09:54 PM, chmike wrote:
The only inconvenience left is that we can't have mutable references
to immutable objects.
There is std.typecons.Rebindable for that.
On 05/28/2016 06:09 PM, chmike wrote:
In the following instruction of the above commit, what effect has the []
after init ?
_store[0 .. __traits(classInstanceSize, T)] = typeid(T).init[];
T is a template argument that is a class derived from Error.
I couldn't find an explanation here
On 05/28/2016 10:34 AM, Mike Parker wrote:
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
[...]
Is a static const Category c variable a TLS variable ?
Yes. All variables are TLS unless explicitly marked with __gshared or
shared.
I don't think that's true.
import core.thread;
On 05/28/2016 02:43 PM, Lodovico Giaretta wrote:
struct S1
{
int doSomething() @safe
{
// do something safely
return 1;
}
}
struct S2
{
int doSomething() @system
{
// do something usafe
return 2;
}
}
auto doSomethingDumb(T)(ref
On 05/26/2016 11:13 PM, Era Scarecrow wrote:
By adding a struct overload for opOpAssign I can shrink it all down
to this, and avoid lengths entirely... As such internally the length
starts at 0, and checks are in place to ensure the bounds are never
exceeded.
void scan(ref Data[][] data,
On 05/26/2016 05:28 PM, ArturG wrote:
On Thursday, 26 May 2016 at 15:25:26 UTC, ag0aep6g wrote:
[...]
What does it matter?
You would have to create special cases for them.
When? If you want to check if something is the .init value, compare
against .init.
On 05/26/2016 04:03 PM, ArturG wrote:
for example:
if(any floatingpoint.init) will be true
if(any char.init) also true
if("") also true
while others are false e.g.
string s;
if(s) will be false
all others are also false or did i miss any?
What does it matter?
On 05/26/2016 09:51 AM, Era Scarecrow wrote:
So I'm experimenting and want to override how arrays are managed for a
short duration, this is for optimization of not having to make another
array to keep track of lengths and then shorten them when i can in fact
just manage it myself *very*
On 05/25/2016 04:39 PM, Chris wrote:
I see. Maybe it would be worth adding a wrapper to typecons.Tuple or
std.range that helps to rangify tuples.
std.range.only is that wrapper.
I cannot think of any use case
right now. I never needed this and in the example that started this
thread, it
On 05/25/2016 03:27 PM, Chris wrote:
Why can the tuple be iterated with foreach, as in my quick fix, and
indexed with tuple[0..], but is not accepted as a range? What are the
differences?
popFront doesn't make sense with a tuple (aka expression list). When you
remove the first element of a
On 05/24/2016 06:22 PM, Edwin van Leeuwen wrote:
That's what I assumed at first.. So why does the following fail with:
cannot interpret double at compile time? I assumed staticMap would
automatically flatten the resulting AliasSeqs.
```
import std.meta : AliasSeq, ApplyLeft, staticMap;
struct
On 05/24/2016 03:59 AM, Jack Stouffer wrote:
parse!int(splitValue.front);
[...]
std.conv.parse(Target, Source)(ref Source s) if (
isSomeChar!(ElementType!Source) && isIntegral!Target && !is(Target
== enum))
You're missing that `parse`'s parameter is `ref`. `splitValue.front` is
On 05/23/2016 08:10 PM, cy wrote:
I was squinting at the std.typecons.NullableRef code and it _looks_ like
isNull is only checked at runtime (and not checked at all in release
mode!) but D has surprised me before in its ability to pre-calculate
stuff during compilation.
NullableRef is little
On 05/21/2016 07:15 PM, Jack Applegame wrote:
Really? Mutating immutable is UB too, but look at std.typecons.Rebindable.
Rebindable uses a union of a mutable and an immutable variant of the
type. No access to the mutable union member is provided, and it's never
dereferenced by Rebindable.
On 05/21/2016 04:39 PM, pineapple wrote:
But I don't understand why. Could someone clarify the difference between
the two?
Common mistake, because other languages (e.g. C#) use similar but
different syntax.
The `foo => bar` syntax doesn't use braces. When you add braces around
bar, that's
On 05/21/2016 03:36 PM, chmike wrote:
Note however that it doesn't work with immutable. It only works with
constant. I guess this is because immutable is "stronger" than const. I
determined that only const was supported by looking at Rebindable's code.
Here is the code that finally works as I
On 05/21/2016 02:17 PM, chmike wrote:
On Saturday, 21 May 2016 at 10:42:13 UTC, chmike wrote:
source/app.d(23,27): Error: cannot implicitly convert expression (one)
of type immutable(Obj) to app.Info
Apparently Rebindable doesn't support polymorphism. This is hopefully
fixable.
No, the
On 05/21/2016 12:42 PM, chmike wrote:
Rebindable!Info x1, x2 = Infos.one;
Rebindable!(immutable Info) x1, x2 = Infos.one;
On 05/21/2016 07:15 AM, Bauss wrote:
On Saturday, 21 May 2016 at 05:03:14 UTC, ag0aep6g wrote:
On 05/21/2016 06:54 AM, Bauss wrote:
When I then compile with dub build I get this error:
Selected package diamond 0.1.0 does not match the dependency
specification >=0.2.1 <0.3.0 in package
On 05/21/2016 06:54 AM, Bauss wrote:
When I then compile with dub build I get this error:
Selected package diamond 0.1.0 does not match the dependency
specification >=0.2.1 <0.3.0 in package diamondtest. Need to "dub upgrade"?
Have you tried "dub upgrade"?
On 05/20/2016 08:23 PM, Jack Applegame wrote:
You can just cast const away:
struct A {
int id = 0;
this(int id) {
this.id = id;
}
void change() const {
(cast() id)++;
}
}
That's not a valid D program, though.
On Thursday, 19 May 2016 at 17:07:27 UTC, Michael wrote:
On Thursday, 19 May 2016 at 15:49:17 UTC, ag0aep6g wrote:
[...]
[1] https://issues.dlang.org/show_bug.cgi?id=16027
Yeah that's what I was thinking but I don't know much about the
optimisation process so I wanted to mention it anyway.
On 05/19/2016 05:09 PM, Michael wrote:
Any idea what causes this to occur when optimising? I wanted to try and
speed up a simulation I'm running but it just produces too many
unexpected consequences.
I suspect that you're seeing issue 16027 [1], a bad bug in 2.071.0. The
upcoming 2.071.1
On 05/19/2016 05:04 PM, chmike wrote:
interface AThing { ??? string name ??? }
class OneThing : AThing { ??? string name ??? "OneThing" ??? }
class OtherThing : AThing { ??? string name ??? "OtherThing" ??? }
void main()
{
// Accessing name as static information
writeln(OneThing.name
On 05/19/2016 03:05 PM, chmike wrote:
I'm planning to call some posix functions core.sys.posix that may set
the errno value in case of error. e.g. read() or write().
Checking the std.exception documentation I see that ErrnoException may
be thrown when errors setting errno may occur. Does this
On 05/17/2016 09:37 PM, WhatMeWorry wrote:
I'm weak enough with C pointers, but when I see char** my brain freezes
up like a deer caught in headlights. Can anyone translate the below C
call into D?
First things first: char** is a perfectly fine D type, of course. But
you probably know that.
On 05/17/2016 07:43 PM, Alex wrote:
The relation is: some object A contains the pointer/iota/(if at all)
some object B makes slices of the thing, which is in A.
Ok, so you have some object that stores a void pointer. The pointer is
going to be null at all times. Then you slice that pointer.
On 05/17/2016 05:33 PM, Alex wrote:
But, if the slicing is made by means of iota, there is no (at least no
explicit) dependence between the slices, which could be made by
different objects.
How is this dependency expressed with slices?
I'm ready to admit, that the process will work with
On 05/17/2016 03:14 PM, Alex wrote:
For a slice I surely need two numbers. But this should all be, what I
need for a slice. For a iota, I need a maximum, which is not provided
(at least at this moment) to the object containing the pointer/iota thing.
The slice's length is practically the same
On 05/17/2016 02:24 PM, Thorsten Sommer wrote:
Dear all,
I run into an issue with a simple cast:
https://dpaste.dzfl.pl/8e7f7c545eb1
I have a base class and a class A with inherit from that base class:
A <- BaseClass
If the base class contains an "alias this", any casting attempt fails
On 05/17/2016 12:53 PM, Alex wrote:
2. If I want to be able to slice a iota, I have to initialize it with
the last number. But the object, which stores the pointer does not need
to know anything about this number. So, I rather would not like to pass
this number only for being able to instantiate
On 05/17/2016 10:16 AM, Rene Zwanenburg wrote:
Additionally, some people recommend never using -release. It depends on
that type of program you're writing, but the performance gain is often
not worth the loss in safety. Think of the number of exploits enabled by
C's lack of bounds checking.
On 05/17/2016 08:53 AM, Alex wrote:
the elements of the slice are accessible just for reading, right, but
with them I reference the data in other objects.
If the slice's pointer is invalid, then its elements are not accessible
at all.
On 05/17/2016 12:43 AM, Alex wrote:
The point is, that in my model the slice has a meaning itself. So, the
language provides one of a needed constructs...
Huh? As far as I understand, the pointer of the slice is invalid, and
you never dereference it. What kind of additional meaning can the
On 05/16/2016 11:33 PM, Alex wrote:
Well... not wanting to have a variable, which stores numbers, which are
natural numbers, beginning with zero, used for counting only.
But you have such a variable: b. I may still be missing the point.
On 05/16/2016 11:35 PM, Alex wrote:
Background:
Say, I have objects of kind E, which operate on structs of kind M. The
problem: if an action is done on a struct, say M42, there should be also
some action done on other structs, which have some relation to M42, but
neither the operating object,
On 05/16/2016 10:39 PM, Alex wrote:
// This function is intentionally templated, as it should take slices
and return something
// boundchecked only
@nogc T[] getSlice(T)(T* ptr, size_t a, size_t b)
{
return T[a .. b];
Typo here. Should be `ptr[a .. b]`.
}
void main()
{
void* ptr;
On 05/16/2016 11:24 AM, Stefan wrote:
source/protocols.d(40,34): Error: uninitialized variable 'value' cannot
be returned from CTFE
Ouch. That's not a good error message. There is no `value` on that line.
I've filed an issue: https://issues.dlang.org/show_bug.cgi?id=16030
this ist the code
On 05/15/2016 08:41 PM, ikod wrote:
How can I get docs generated for int z?
-
string V(string var) {
return "int " ~ var ~ ";";
}
///
struct X {
/// comment for y
int y;
/// comment for z
mixin(V("z"));
}
void main()
{
}
-
"dmd -D -Dddocs" generate docs for
Am 10.05.2016 um 21:43 schrieb Lodovico Giaretta:
alias Node(T) = RefCounted!(_Node!T);
struct _Node(T)
{
Node!T parent; // error: recursive template expansion
}
I think this is expected. Can't have cycles like that in template
instantiations.
Am 10.05.2016 um 21:43 schrieb Lodovico Giaretta:
import std.typecons: RefCounted;
struct S
{
RefCounted!S s; // error: struct S no size yet for forward reference
}
This used to work with 2.067. I've filed a phobos regression for this
very code, and two related dmd issues with different
Am 10.05.2016 um 12:21 schrieb ZombineDev:
auto indexed_range = lockstep(
Tiny nitpick: lockstep doesn't return a range. It uses opApply to
support foreach.
On 03.05.2016 23:31, Erik Smith wrote:
void myVaridatic(A...)(A a) {}
Aside: I think it's "variadic", not "varidatic".
static void call(alias F,A...)(F f,A a) {
static void call(alias f, A...)(A a) {
f(a);
}
void foo() {
On 03.05.2016 18:03, Jonathan Villa wrote:
public final class accounts
{
public:
static table_user user;
}
public final class table_user
{
private:
static uint32 dummy1;
static string dummy2;
static DateTime dummy3;
static ubyte dummy4;
On 02.05.2016 15:53, Marco Leise wrote:
immutable tab = { static enum S[] s = [
`static enum`? What kind of black magic is this?
On 01.05.2016 15:32, pineapple wrote:
static string vectorpropertymixin(string name, string SDL_getter, string
SDL_setter){
[...]
mixin(vectorpropertymixin(
"minsize", "SDL_GetWindowMinimumSize", "SDL_GetWindowMinimumSize"
));
Should the second one be "SDL_SetWindowMinimumSize" here?
On 01.05.2016 07:29, TheGag96 wrote:
Why exactly is it like this? I would understand why strings (immutable
character arrays) behave like this, but I feel like plain old character
arrays should work the same as an array of ubytes when treated as a
range... Or is there some other string-related
On 30.04.2016 21:41, Jon D wrote:
I didn't mean to suggest making the documentation technically incorrect.
Just that it be helpful in important cases that won't necessarily be
obvious. To me, char[] is an important case, one that's not made obvious
by listing the hasLvalueElements constraint by
On 30.04.2016 21:08, Jon D wrote:
If an initial step is to fix the documentation, it would be helpful to
include specifically that it doesn't work with characters. It's not
obvious that characters don't meet the requirement.
Characters are not the problem. remove works fine on a range of
On 30.04.2016 18:44, TheGag96 wrote:
I was just writing some code trying to remove a value from a character
array, but the compiler complained "No overload matches for remove", and
if I specifically say use std.algorithm.remove() the compiler doesn't
think it fits any definition. For reference,
On 27.04.2016 21:40, xtreak wrote:
import std.array;
import std.range;
import std.algorithm;
import std.stdio;
T test(alias f, T)(T num) {
return f(num);
}
T test1(T, V)(T num, V f){
return f(num);
}
void main() {
writeln("hello world");
writeln(1.iota
.map!(a =>
On 27.04.2016 13:06, Nordlöw wrote:
/** Returns: a `string` containing the definition of an `enum` named
`name` and
with enumerator names given by `Es`, optionally prepended with
`prefix` and
appended with `suffix`.
TODO Move to Phobos std.typecons
*/
string
On 26.04.2016 15:35, Begah wrote:
Nothing will reload.
An example :
I load a texture "button.png" in a class and draw it to the screen,
When the screen switches to another screen ie from menu to the game,
I want that the "button.png" texture is automaticly destroyed by the gc.
But this will
On 24.04.2016 13:03, Lass Safin wrote:
// Omitting the required imports.
void[] ptr;
void main() {
uint buffer;
glCreateBuffers(1, );
// Filling the buffer with data and such...
ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT |
On 23.04.2016 21:49, xtreak wrote:
I am a D newbie from Python and I am trying to grok alias. Is alias like
Python does as below
L = []
myextend = L.extend
L.myextend
My Python isn't too great, but I think this is more similar to function
pointers or delegates in D.
Renaming imported
On 23.04.2016 07:35, ag0aep6g wrote:
So the struct is destroyed at the end of DoDirSearch, despite there
being a closure for it. Is the compiler doing the right thing here?
Shouldn't the struct be considered alive until the closure gets garbage
collected?
I've filed an issue:
On 23.04.2016 03:11, Ramon wrote:
mmm, I figured the problem, but don't know how to solve it.
my struct has a destructor which clears itself:
struct json_value
{
~this() { .ValueClear(); }
}
So the struct is destroyed at the end of DoDirSearch, despite there
being a closure for it. Is the
On 22.04.2016 13:46, Jeff Thompson wrote:
The function literal also works if I add
"function int[]()":
void main(string[] args) {
immutable int[] array = function int[]() {
int[] result = new int[10];
result[0] = 1;
return result;
}();
}
I take it you're on 2.070 or older
On 22.04.2016 13:07, Jeff Thompson wrote:
OK, we lose the compiler check for correctness. What if I put func
directly in main with the hopes that the compiler will check correctness
and also inline the function? But it won't assign to the immutable
array. Why not? It's the same function.
void
On 21.04.2016 19:10, jacob wrote:
private void runner(T)()
{
shared(T*) s = receiveOnly!(shared(T*))();
This tries to receive a `shared(S!(M, 2)*)`.
writeln(s.x.length);
writeln(s.x[0]);
send(thisTid, true);
Aside: Should be `ownerTid` here, no?
}
int main(string[]
On 21.04.2016 04:35, Alex Parrill wrote:
On Wednesday, 20 April 2016 at 22:44:37 UTC, ag0aep6g wrote:
On 20.04.2016 23:59, Alex Parrill wrote:
[...]
That's not assigning the elements of a void[]; it's just changing what
the slice points to and adjusting the length, like doing `void* ptr =
On 20.04.2016 23:59, Alex Parrill wrote:
On Wednesday, 20 April 2016 at 17:09:29 UTC, Matt Kline wrote:
[...]
First, you can't assign anything to a void[], for the same reason you
can't dereference a void*. This includes the slice assignment that you
are trying to do in `buf[0..minLen] =
601 - 700 of 750 matches
Mail list logo