www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why do i need to import a freaking module to use int128?

reply ryuukk_ <ryuukk.dev gmail.com> writes:
Literally the worst idea ever, is this javascript?

Don't make people want to choose something else 
https://ziglang.org/documentation/master/#toc-Primitive-Types

A module for a database driver? yes

A module for abstracting networking? yes

A module for formatting text? yes

A module for primitive types? NO, stop everything you do and 
think about the purpose of your language
Nov 27 2023
next sibling parent Kagamin <spam here.lot> writes:
That's tame, I have a module that defines
```
/// Signed integer of pointer size
alias ptrdiff_t intp;
/// Unsigned integer of pointer size
alias size_t uintp;
/// Signed integer of byte size
alias byte tiny;
/// Unsigned integer of byte size
alias ubyte utiny;
```
Nov 27 2023
prev sibling next sibling parent reply Sergey <kornburn yandex.ru> writes:
On Monday, 27 November 2023 at 12:20:23 UTC, ryuukk_ wrote:
 Literally the worst idea ever, is this javascript?
This is a new module. Some (quite short) time ago there was even no any support for i128. And support of this type is quite new for all languages (not only for D): https://forums.swift.org/t/status-check-int128-uint128/67694 And I'm not sure this module should be imported for everyone by default. If it adds size into binary and some complexity into internals, while usage of i128 not so common.. So first of all - keep calm, add more technical knowledge, instead of impulsive ranting. There is also BigInt which is usually going into a separate module in many languages. But I agree that numeric types could be revisited and improved - probably into one module: Numerics with separate sub-modules (i128, f16, f8, BigInt, etc). As I already mentioned in Discord half-float (bad name btw) which is usually called float16 was ready for merge - but then some strange comments for PR about process and other bs.. and the code just became abandoned and forgotten.
Nov 27 2023
next sibling parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 28/11/2023 1:54 AM, Sergey wrote:
 There is also BigInt which is usually going into a separate module in 
 many languages.
Big integers require memory allocations. They are a completely unrelated in terms of implementation to 128bit integer types which can be implemented using pretty simple instructions comparatively.
Nov 27 2023
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/27/2023 4:54 AM, Sergey wrote:
 As I already mentioned in Discord half-float (bad name btw) which is usually 
 called float16 was ready for merge - but then some strange comments for PR
about 
 process and other bs.. and the code just became abandoned and forgotten.
You can find halffloat here: https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d
Nov 28 2023
prev sibling next sibling parent reply IGotD- <nise nise.com> writes:
On Monday, 27 November 2023 at 12:20:23 UTC, ryuukk_ wrote:
 Literally the worst idea ever, is this javascript?

 Don't make people want to choose something else 
 https://ziglang.org/documentation/master/#toc-Primitive-Types

 A module for a database driver? yes

 A module for abstracting networking? yes

 A module for formatting text? yes

 A module for primitive types? NO, stop everything you do and 
 think about the purpose of your language
Question, because int128 is a library type, does it mean that the code is less optimized compared to if the int128 would be a built in type?
Nov 27 2023
parent Daniel N <no public.email> writes:
On Monday, 27 November 2023 at 13:01:12 UTC, IGotD- wrote:
 On Monday, 27 November 2023 at 12:20:23 UTC, ryuukk_ wrote:
 Literally the worst idea ever, is this javascript?
Question, because int128 is a library type, does it mean that the code is less optimized compared to if the int128 would be a built in type?
In dmd maybe, but ldc/gdc can use native backend type, iirc.
Nov 27 2023
prev sibling parent Alexandru Ermicioi <alexandru.ermicioi gmail.com> writes:
On Monday, 27 November 2023 at 12:20:23 UTC, ryuukk_ wrote:
 Literally the worst idea ever, is this javascript?
If you'd get IDE integration to auto import the module, I don't think it would be a problem, unless it is a forever one line module.
Nov 27 2023