Nick Treleaven
d9fd09d73a
[std.algorithm.iteration] Tweak splitter, splitWhen docs ( #10733 )
...
Update splitter cheat sheet for non-separator overloads.
Add constraint for splitWhen's `pred`.
`splitter!isTerminator` always returns a forward range.
2025-04-02 20:37:50 +08:00
Dennis
ff612b867c
Merge pull request #10732 from dlang/stable
...
Merge stable
2025-04-02 13:43:44 +02:00
David Isinta Nyakawa
82338661b3
Fix Issue 10523 - Enabled BigInt to work in CTFE ( #10725 )
...
made biguint core ctfe valid by removing free keyword at compile time
2025-04-02 13:28:08 +08:00
Nick Treleaven
a86eaca27b
[std.algorithm] Separate splitter
overload with isTerminator parameter ( #10729 )
...
This makes it easier to follow the docs.
Move 2 documented unittests under isTerminator overload.
Tweak isWhite example to use `\t`, not just a single space.
2025-04-02 07:53:23 +08:00
Vladimir Panteleev
94903c884a
std.net.curl: Fix fast-path check when encoding is "utf-8" (lower-case) ( #10721 )
...
For HTTP, the response body encoding is specified in the
"Content-Type" header, e.g.: "Content-Type: application/json;
charset=utf-8".
MDN says:
> - `charset`: Indicates the character encoding standard used.
> The value is **case insensitive but lowercase is preferred**.
However, `_decodeContent` was comparing the encoding with the exact
string "UTF-8", which causes most HTTP requests to go through the slow
path.
Fix this by using `icmp`, like elsewhere in the module for
case-insensitive string comparisons.
2025-03-29 18:59:08 +08:00
Aditya Chincholkar
1de571c710
Adding a lazy version of std.algorithm.iteration.cache #10687 Open Feature ( #10709 )
...
* added Lazycache feature
* Added Lazycache funtion
* changes as per review
* Update std/algorithm/iteration.d
Co-authored-by: Richard (Rikki) Andrew Cattermole <pbdadmin@gmail.com>
* removing unrelated change
* added lazychache in cheatsheet
* removed error
* add_lazycache_function.dd
* changes in changelog
* lines changes in changelog
* removing whitspace
---------
Co-authored-by: Richard (Rikki) Andrew Cattermole <pbdadmin@gmail.com>
2025-03-28 15:23:30 -07:00
Paul Backus
b7395ea7f5
std.conv: add writeText, writeWText, writeDText ( #10652 )
...
* std.conv: factor out writeTextImpl from textImpl
* std.conv: add writeText, writeWText, writeDText
These are variants of text, wtext, and dtext that write their output to
an output range instead of returning a string.
Fixes #10550
* Add changelog entry for writeText
2025-03-28 15:23:12 -07:00
Richard (Rikki) Andrew Cattermole
205256abb1
Fix #10699 - std.format with position with omitted second number does not work ( #10716 )
2025-03-28 01:49:06 -07:00
Aditya Chincholkar
dfc3d021c6
Fix #10513 - powmod is slow for ulong ( #10688 )
...
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
2025-03-27 17:54:57 +08:00
Elias Batek
89f5914683
Revert "Fix #9584 - Using dirEntries and chdir() can have unwanted results ( #10666 )" ( #10718 )
...
This essentially reverts commit 274109b3de
.
2025-03-27 16:21:21 +08:00
Iain Buclaw
530660bd9b
std.allocator: Comment out broken class instance size test ( #10717 )
...
This can be reverted after the fix for dlang issue 21065 is merged
Refs: dlang/dmd#21065
2025-03-27 07:31:01 +08:00
Inkrementator
0edef23caf
Variant segfault ( #10697 )
...
* Reference correct issue for test
* Variant: Fix Segfault on adding in wrapped AA
2025-03-26 07:14:47 +08:00
Richard (Rikki) Andrew Cattermole
c64232d813
Fix #10713 - std.format string positions affect all further format specifiers ( #10714 )
2025-03-25 16:10:34 +08:00
Inkrementator
91af96cddb
Change documentation for reduce ( #10707 )
...
* reduce: Document Acc, Elem order in most visible place
* Reduce doesn't enforce predicates
* Reduce: Document behaviour on range with 1 elem
* Doc: Remove references to implemententation detail
Accumulator is the commonly used term for this concept.
2025-03-24 05:39:45 +08:00
Elias Batek
12f99e5fff
Remove empty line between doc comment and unittest ( #10705 )
2025-03-23 16:23:10 +08:00
Martin Kinkelin
b41bcd93df
std.experimental.allocator.building_blocks.allocator_list: Fix unittests on macOS arm64 ( #10704 )
...
Otherwise hitting a consistently failing assertion for LDC CI.
2025-03-23 07:51:23 +08:00
Paul Backus
3dc8091758
Merge pull request #10703 from VPanteleev-S7/json-tohash
...
std.json: Add JSONValue.toHash
2025-03-22 15:42:05 -04:00
Vladimir Panteleev
6beff688d2
std.json: Add JSONValue.toHash
...
Allows using JSON values in sets and map keys.
2025-03-22 17:38:24 +00:00
Paul Backus
1fab9aca41
Fix #10701 - Broken link in documentation of randomUUID ( #10702 )
...
Arguments to DDoc macros must be separated by a comma and at most one
space, not spread over multiple lines.
2025-03-21 04:24:23 +08:00
Iain Buclaw
0f3185e954
std.numeric: Fix IEEE typo in link
2025-03-20 15:11:25 +01:00
Nick Treleaven
2ceb13ed44
std.traits.TemplateOf doesn't return void for non-template functions #10527
2025-03-19 14:47:43 +00:00
Inkrementator
67afde4f10
Fix #9585 Add check variant
alignment ( #10690 )
...
* Fix #9585 Add check `variant` alignment
There has been code that handles alignment for a long time
now, and while this module is unlikely to be touched anymore, create a
regression test so the issue can be closed.
* Apparently double is 32bit aligned on x86
2025-03-19 12:20:30 +08:00
Inkrementator
c79914db2d
Fix #10440 Use right template constraint for each
( #10689 )
...
The current contraints have been implemented in #3837 to make `each`
behave more like `foreach` and automatically destructure tuples.
I haven't publically documented this behavior because it is probably
better these days to use `bind` for that.
2025-03-19 07:14:17 +08:00
The Dlang Bot
56f8c64df4
Merge pull request #10686 from Inkrementator/hypot_complex_abs_fixes
...
Unify abs(Complex!T) and hypot
Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com>
Merged-on-behalf-of: Iain Buclaw <ibuclaw@users.noreply.github.com>
2025-03-18 13:35:41 +01:00
Inkrementator
5329c10555
Optimization: Use u*u over u^^2 for better inlining
2025-03-18 00:19:13 +01:00
Inkrementator
006b1ca936
Logic: Move (huge,tiny) test up, supersedes testing for 0.0
2025-03-18 00:19:11 +01:00
Steven Schveighoffer
79cbde1ab6
Fix #10680 - Instead of passing receiver into the conversion function, ( #10684 )
...
just return the value and assign it to the receiver. Renamed the
conversion function and also cleaned up all the `typeof` calls, which
were very verbose.
2025-03-18 06:38:36 +08:00
gulugulubing
e8a7280b5d
Remove outdated @safe bug entry from toDelegate documentation ( #10672 )
2025-03-18 06:36:21 +08:00
Elias Batek
b150fde4da
Improve the situation with #9881 - Use unpredictableSeed
in randomUUID()
( #10671 )
2025-03-17 15:10:26 -07:00
Inkrementator
da127b18b8
Add regression test for #10491
2025-03-17 22:40:33 +01:00
Inkrementator
63ce5c37c0
Optimization: Move NaN-check inside branch where it is guaranteed to happen
2025-03-17 22:40:33 +01:00
Inkrementator
91aa5feead
Unify hypot
and abs of complex values
...
This ports the fixes from abs(T)(ComplexT) regarding NaN and skipping
potentially inaccuracy inducing mathematical no-ops when one arg is 0 to
hypot. Both functions do the same thing and should be deduplicated.
hypot also has some logic regarding under and overflows, and while I
don't fully understand it, it should probably not be removed for complex
numbers.
2025-03-17 22:40:31 +01:00
Martin Kinkelin
cafe864533
std.json: Avoid setting union members, set the whole union instead ( #10683 )
...
To work around https://github.com/dlang/dmd/issues/20675 .
2025-03-17 22:24:14 +08:00
Aditya Chincholkar
e1d9d0208b
Fix issue #10491 Complex!float.abs / hypot invalid result when argument is small ( #10679 )
2025-03-17 22:18:39 +08:00
Aditya Chincholkar
fd4979ab99
Fix issue #9829 std.conv.parse!(int, string) counts when doCount is false ( #10674 )
2025-03-17 22:15:40 +08:00
Aditya Chincholkar
271ae6219d
Fix #10577 - [std.math] std.math.algebraic.cbrt is not pure ( #10670 )
2025-03-16 07:24:13 +08:00
Elias Batek
13279b8594
Add additional tests to std.conv
( #10673 )
2025-03-15 16:28:45 +08:00
Elias Batek
264618e838
Cleanup DirIteratorImpl.__ctor
( #10668 )
2025-03-15 08:41:33 +08:00
Elias Batek
1e70ab9301
Remove range support from DirIteratorImpl.__ctor
( #10667 )
...
Was unused, untested and potentially broken.
2025-03-13 15:56:08 +08:00
Elias Batek
274109b3de
Fix #9584 - Using dirEntries and chdir() can have unwanted results ( #10666 )
...
Co-authored-by: GallaFrancesco <francesco.galla3@gmail.com>
Co-authored-by: Elias Batek <15967408+0xEAB@users.noreply.github.com>
2025-03-12 16:14:48 +08:00
Paul Backus
613ec088e4
sumtype: rename 'degrees' to 'value' in example
...
Strictly speaking, the Kelvin scale is not measured in degrees, so the
previous name was incorrect. Changing it in all cases preserves
consistency.
Fixes #10540
2025-03-11 10:33:32 -04:00
Paul Backus
3f990a7e25
Merge pull request #10650 from pbackus/sumtype-proc-api
...
Procedural API for SumType
2025-03-03 23:19:20 -05:00
Paul Backus
4a91ed7033
stdio: add readfln and File.readfln
...
Compared to readf, these functions provide a less error-prone way to
read a single line of formatted input.
Fixes #10370
2025-03-03 03:47:52 +01:00
Nicolò Monaldini
0d724aa0c8
Fix %*s handling by formattedRead() ( #10654 )
2025-03-03 06:59:08 +08:00
dhawal543
4b39202045
Fix #10565 : Prevent negative zero when multiplying BigInt zero by neg… ( #10655 )
2025-03-02 21:08:03 +08:00
Paul Backus
6722d0a50b
Add std.conv.bitCast ( #10651 )
...
* Add std.conv.bitCast
This helper function is a more readable alternative to the traditional
pointer-cast-based syntax for reinterpreting casts.
The name bitCast is used for this operation in several other languages,
including C++ [1], Swift [2], C# [3], Zig [4], and LLVM IR [5].
[1] https://en.cppreference.com/w/cpp/numeric/bit_cast
[2] https://developer.apple.com/documentation/swift/unsafebitcast(_:to:)
[3] https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafe.bitcast
[4] https://ziglang.org/documentation/0.10.0/#bitCast
[5] https://llvm.org/docs/LangRef.html#bitcast-to-instruction
* Add changelog entry for std.conv.bitCast
2025-02-28 13:54:10 -08:00
Paul Backus
1d3177ff2a
sumtype: prevent ambiguity in failedGetMessage
2025-02-27 10:01:43 -05:00
Paul Backus
03f7dbab9d
sumtype: make has!T.checkType helper private
2025-02-27 09:49:29 -05:00
Paul Backus
7e34f06d83
sumtype: extract common code from get and tryGet
2025-02-24 14:26:39 -05:00
Paul Backus
688ecf2089
sumtype: add tryGet!T, a throwing version of get!T
2025-02-24 14:25:51 -05:00