Commit graph

396 commits

Author SHA1 Message Date
Martin Nowak
e45f39c55a Merge remote-tracking branch 'upstream/stable' into merge_stable 2015-08-10 10:07:27 +02:00
k-hara
eff54e62ca fix Issue 14890 - Can not construct a RedBlackTree of Tuples 2015-08-10 11:58:01 +09:00
Martin Nowak
5ca7ddad60 Merge remote-tracking branch 'upstream/stable' into merge_stable
Conflicts:
	posix.mak

Manually edited:
	std/datetime.d (rename toNormalizedPath -> asNormalizedPath)
2015-07-24 01:28:58 +02:00
Martin Nowak
60f9b8b538 Revert "Merge pull request #3139 from mrkline/better-unique"
This reverts commit 8f4a85bc83, reversing
changes made to d74e4d787a.

Delay unfinished feature until after 2.068.x.
2015-07-21 09:31:54 +02:00
Steven Schveighoffer
c7ea82e3f5 Merge pull request #3462 from japplegame/patch-1
Rebindable support for AAs.
2015-07-20 15:22:31 -04:00
Jack Applegame
66e3a52a62 Rebindable support for AAs 2015-07-17 10:21:31 +03:00
H. S. Teoh
6a27c5803b Fix grammar in BitFlags docs. 2015-07-15 14:54:35 -07:00
Robert Schadek
5faa1ccfc1 Merge pull request #3158 from tom-tan/workaround-for-14405
Add workaround for issue 1238
2015-06-27 16:08:42 +02:00
Andrei Alexandrescu
b0af624aa3 Always add function linkage 2015-06-08 13:14:07 -07:00
Andrei Alexandrescu
5f0a1a6751 Add ReplaceType, use it in Algebraic. Also add get!k to Variant. 2015-06-08 10:52:11 -07:00
Rainer Schuetze
adab223837 remove trailing whitespace, detab, tolf 2015-05-31 11:24:01 +02:00
Robert burner Schadek
787637debd deprecate std.stream and friends 2015-05-28 06:48:28 +02:00
Martin Nowak
9a473ab891 enable ref escape checking for struct RefCounted 2015-05-13 01:15:14 +02:00
Walter Bright
d9a9826e55 Revert "Introducing std.meta package" 2015-05-06 14:36:45 -07:00
Dicebot
7970fcc748 Don't use fqn for any/all
In most cases it resolves unambiguosly
2015-05-05 22:22:11 +03:00
Dicebot
a76d90c927 Phobos should only mention tuple as std.typecons.Tuple 2015-05-05 22:22:11 +03:00
Dicebot
1c9ae027ef Rename old std.typetuple symbols inside Phobos
staticIndexOf -> indexOf
allSatisfy -> all
anySatisfy -> any
staticMap -> Map
2015-05-05 22:22:11 +03:00
Dicebot
82f54a38d3 TypeTuple -> MetaList inside Phobos 2015-05-05 22:22:11 +03:00
Dicebot
73f773838d import std.typetuple -> import std.meta 2015-05-05 22:22:10 +03:00
Martin Nowak
8f4a85bc83 Merge pull request #3139 from mrkline/better-unique
Improve std.typecons.Unique
2015-04-24 20:24:18 +02:00
Matt Kline
5054c6f689 Elaborate on nested types and Unique
They don't go well together.
2015-04-24 00:49:33 -07:00
Matt Kline
ad3784f3b3 Cleanup of Unique as per Martin Nowak's suggestions
See https://github.com/D-Programming-Language/phobos/pull/3139
2015-04-24 00:40:54 -07:00
Matt Kline
5a34389f39 Fix typo in Unique.create 2015-04-21 01:08:58 -07:00
Matt Kline
1204e04e1e Unique for classes returns the object pointer 2015-04-21 01:06:02 -07:00
Matt Kline
1cc0b48789 Use emplace to set up structs for Unique 2015-04-21 01:02:48 -07:00
JakobOvrum
f7498ad8ec Merge pull request #3171 from MartinNowak/refCounted
fix Issue 14432 - move construction for RefCounted
2015-04-20 22:44:18 +09:00
Matt Kline
d2289a4d41 Return Unique.release to original form, deprecate it 2015-04-19 18:24:57 -07:00
Martin Nowak
1e19a4f713 use typeid(T).init() to reset moved value 2015-04-20 00:53:04 +02:00
JakobOvrum
ddfd111ab5 Merge pull request #3114 from MetaLang/nullable-doc-fixes
Improve Nullable documentation
2015-04-18 15:25:09 +09:00
Matt Kline
d24b738ccc Clean up Unique alias this 2015-04-17 00:32:05 -07:00
Matt Kline
836c55197e Do not let Unique escape underlying references
See https://github.com/D-Programming-Language/phobos/pull/3139#discussion-diff-28203345
2015-04-17 00:24:22 -07:00
Matt Kline
e112ec9b7f Return Unique to malloc/free
Marking its various bits as @nogc is still proving to be a challenge
since Object.destroy is not @nogc, among other things.

We _are_ using GC.addRange and GC.removeRange to handle anything
inside the underlying type that uses GC.
Why the user would do this in conjunction with Unique is
questionable, but until we can explicitly forbid doing so, let's
not break garbage collection for them.

Note that this also makes nested structs and classes impossible,
because there is no way AFAIK to get the frame pointer into
unique()
2015-04-16 23:58:28 -07:00
Matt Kline
c5605bf2c8 Turn Unique.create into a freestanding unique()
Also cleaned up the Unique documentation a bit.
Unfortunately some of the unittests could not be used as documented
unittests because placing them in the struct gives an error about
RTInfo!(Nested) being recursvely expanded.
2015-04-13 00:04:00 -07:00
Walter Bright
0d73c992a2 Merge pull request #3176 from MetaLang/whitehole-doc
Improve WhiteHole documentation
2015-04-12 00:36:06 -07:00
MetaLang
f581679303 Improve WhiteHole documentation 2015-04-11 16:34:55 -03:00
Martin Nowak
d288fb41dc Merge pull request #3169 from MetaLang/nullableref-doc-fix
Improve NullableRef documentation
2015-04-11 20:13:04 +02:00
JakobOvrum
1f6c706ffc Merge pull request #3175 from MetaLang/blackhole-doc
Improve Blackhole documentation
2015-04-11 20:03:31 +09:00
MetaLang
05788f5c23 [Trivial] Add one word generateEmptyFunction and generateAssertTrap descriptions 2015-04-11 03:02:22 -03:00
MetaLang
721dd55da7 Improve Blackhole documentation 2015-04-11 02:53:31 -03:00
MetaLang
184bdb2e3f Improve NullableRef documentation 2015-04-10 23:56:14 -03:00
MetaLang
bfa6cd72ae Improve Nullable documentation 2015-04-10 23:32:06 -03:00
Martin Nowak
74a2199760 use onOutOfMemoryError instead of enforce 2015-04-10 05:20:42 +02:00
Martin Nowak
a6a6870beb fix Issue 14432 - move construction for RefCounted
- add RefCounted!T.this(T) which takes an RValue or a copy
  and use move to initialized the refcounted store

- add refCounted to infer T from the argument and disable
  RefCounted's autoInit, also move initializes the store
2015-04-10 05:16:54 +02:00
Matt Kline
dba6bd5464 Revamp and cleanup of Unique
From the related pull request
(https://github.com/D-Programming-Language/phobos/pull/3139),
there seems to be a general consensus that it is more important to
do Unique "right", even if that means breaking changes, so long as
there is a clean migration path. With that in mind, I have made the
following additional changes:

- Instead of constructors that take a RefT, Uniques can now be
  created one of two ways: via .create or .fromNested.
  See the DDocs of both for details.

- opDot is replaced with "alias _p this". A cursorty Google search
  indicates that opDot is deprecated and that alias this is the
  preferred method. Like C++'s unique_ptr, Unique now enjoys
  pointer-like operations (such as dereferencing),
  but cannot be set to null or assigned from a different pointer
  due to opAssign and the disabled postblit constructor.

- Consequently, isEmpty has been removed. Instead, just use
  is null as you would with a pointer.

- Removal of redundant unit tests

- Various comment and unit test cleanup
2015-04-06 23:25:23 -07:00
Tomoya Tanjo
a96d7c0b49 Add workaround for issue 1238 2015-04-07 15:21:27 +09:00
Matt Kline
b3c94c26d1 Make Unique use the GC again
It is currently impossible (or so it seems) to use malloc and
emplace to create a nested class or struct, so we'll return to
using the GC for now. We'll also restore the constructors that take
a RefT, as using new _inside_ the context of the nested class or
struct is apparently the only way to create one currently.
2015-04-05 15:44:02 -07:00
Matt Kline
6d42be9fdd Use class version of std.conv.emplace for Unique
I picked up the trick of converting a pointer into an array
using the [0 .. size] syntax from std/regex/package.d.

Unique.create is still segfaulting, but this seems to be an issue
with the class version of emplace regardless of this Unique work.
The bug can be found here:
https://issues.dlang.org/show_bug.cgi?id=14402
2015-04-03 01:29:23 -07:00
Matt Kline
a5150a043b Fix outOfMemoryError import 2015-04-03 00:57:12 -07:00
Matt Kline
db544d55d5 Issue onOutOfMemoryError on bad malloc in Unique 2015-04-03 00:45:23 -07:00
Matt Kline
f6994ea02f Improve std.typecons.Unique
Whenever D is brought up to the general programming public,
the garbage collector is quickly raised as a point of contention.
Regardless of how legitimate or well-informed these concerns are,
it would be a massive public relations boon --- and great for the language,
to boot --- if we could trot out a solid said of RAII-based smart pointers
for those who prefer to use them. We have a solid start in
std.typecons.Unique and std.typecons.RefCounted.
Unfortunately, these classes seem to be victims of bit rot and
compiler bugs of days long gone.

An overview of the changes in this commit is as follows:

- Unique's underlying data now uses malloc and free
  instead of the garbage collector. Given that many people use RAII
  smart pointers to escape the GC, it seems to make more sense to
  avoid it here. On a related note, isn't delete deprecated?
  The current destructor uses it.

- std.algorithm.move is used instead of a special release
  member function. Whether by design or by happy accident,
  move transfers ownership between Unique pointers in a very
  similar manner to C++'s std::move with std::unique_ptr.
  Along with being a familiar paradigm to C++ users,
  using move to transfer ownership makes more intuitive sense
  and builds consistency with the rest of Phobos.

- With std.algorithm.move transferring ownership, release now just
  frees the underlying pointer and nulls the Unique.

- Unique.create is no longer compiled out using version(None).
  Regardless of whether or not there is language support for
  checking uniqueness, a utility function that creates a Unique,
  taking the same arguments as the underlying type's constructor,
  is extremely useful, as demonstrated by the addition of
  make_unique to C++14.

- Because Unique.create is now in place and Unique is backed with
  malloc, constructors taking a pointer have been removed.
  This encourages the use of create as the idiomatic,
  consistent method to, well, create Unique objects.
  If one can only get a Unique by calling create or moving another
  into it, we also ensures uniqueness in one fell swoop.

- A new method, get, returns the underlying pointer, for use in
  functions and code that do not play a role in the life cycle
  of the object. Smart pointers are as much about ownership
  semantics as they are about allocating and freeing memory,
  and non-owning code should continue to refer to data using a raw
  pointer or a reference.
2015-04-02 01:17:40 -07:00