March 15, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sun, Mar 15, 2015 at 04:21:09PM -0700, Andrei Alexandrescu via Digitalmars-d wrote: > On 3/15/15 12:46 PM, Walter Bright wrote: > >HexStrings: > > > > http://dlang.org/lex.html#HexString > > > >They're rarely used, but very useful when needed. But, as the octal literals have shown, they can be easily replaced with a library template: > > > > x"00 FBCD 32FD 0A" > > > >becomes: > > > > hex!"00 FBCD 32FD 0A" > > > >It'll simplify the core language slightly. > > > >Thoughts? Anyone want to write the hex template? Any other ideas on things that can removed from the core language and replaced with library entities? > > hexString and hexBytes. -- Andrei Even better! T -- Nothing in the world is more distasteful to a man than to take the path that leads to himself. -- Herman Hesse |
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 3/15/2015 4:28 PM, Andrei Alexandrescu wrote:
> That's what nice about library artifacts vs. language artifacts: you can add
> more of the former! Define hexBytes and hexString. -- Andrei
Yup. Should resist the urge to "fix" hexString, just make it a dropin replacement.
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Sunday, 15 March 2015 at 20:36:18 UTC, Marc Schütz wrote: > On Sunday, 15 March 2015 at 19:55:39 UTC, Kagamin wrote: >> http://dpaste.dzfl.pl/0f63623cc262a ? > > Wrong link? Or wrong thread? On Sunday, 15 March 2015 at 19:47:06 UTC, Walter Bright wrote: > Any other ideas on things that can removed from the core language and replaced with library entities? |
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Baz | On Sunday, 15 March 2015 at 21:44:38 UTC, Baz wrote:
> Yes, i'll send a PR tomorrow of tuesday.
Thank you !
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Monday, 16 March 2015 at 07:45:16 UTC, Kagamin wrote:
> On Sunday, 15 March 2015 at 20:36:18 UTC, Marc Schütz wrote:
>> On Sunday, 15 March 2015 at 19:55:39 UTC, Kagamin wrote:
>>> http://dpaste.dzfl.pl/0f63623cc262a ?
>>
>> Wrong link? Or wrong thread?
>
> On Sunday, 15 March 2015 at 19:47:06 UTC, Walter Bright wrote:
>> Any other ideas on things that can removed from the core language and replaced with library entities?
Ok, I get it now. But this replaces only `scope(exit)`. What about `scope(success)` and `scope(failure)`?
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Baz | On Sunday, 15 March 2015 at 21:18:11 UTC, Baz wrote:
> On Sunday, 15 March 2015 at 19:47:06 UTC, Walter Bright wrote:
>> HexStrings:
>>
>> http://dlang.org/lex.html#HexString
>>
>> They're rarely used, but very useful when needed. But, as the octal literals have shown, they can be easily replaced with a library template:
>>
>> x"00 FBCD 32FD 0A"
>>
>> becomes:
>>
>> hex!"00 FBCD 32FD 0A"
>>
>> Thoughts? Anyone want to write the hex template?
>
> I'd be interested. Here's a quick draft based on octal:
>
> http://dpaste.dzfl.pl/656a94cdfdba
Nitpick: "Literal" is spelled with one "t".
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 15/03/2015 19:46, Walter Bright wrote: > Any other ideas on things that can removed from the core language and > replaced with library entities? 0b1010 binary literals (even though C++11 supports them) 0xABCD hex literals (but useful for porting C) Also, there are some things which I think are unnecessary: /++/ - If we made /**/ nest, /++/ would be unnecessary. It would potentially break code, but I think it would always cause a compiler error so breakage wouldn't be silent. I think good C code tends to avoid having /* /* */ comments (and instead uses #if 0 ... #endif). q"''" non-nested delimited strings. Delimited strings seem to be quite rarely used, but the non-matching form I've never seem in the wild. Probably any intended use of these could instead use the q"[]" matching form or raw `` or heredoc strings instead. |
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Treleaven | On Monday, 16 March 2015 at 12:53:24 UTC, Nick Treleaven wrote:
> /++/ - If we made /**/ nest, /++/ would be unnecessary
I'd just drop nested comments: block comments and version(none) are good enough.
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin Attachments: | On Mon, 16 Mar 2015 14:22:38 +0000, Kagamin wrote:
> On Monday, 16 March 2015 at 12:53:24 UTC, Nick Treleaven wrote:
>> /++/ - If we made /**/ nest, /++/ would be unnecessary
>
> I'd just drop nested comments: block comments and version(none)
> are good enough.
and i'll drop `*`. there is no reason to have multiply operator, we already have `+`!
|
March 16, 2015 Re: Replace core language HexStrings with library entity | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Monday, 16 March 2015 at 14:26:27 UTC, ketmar wrote:
> On Mon, 16 Mar 2015 14:22:38 +0000, Kagamin wrote:
>
>> On Monday, 16 March 2015 at 12:53:24 UTC, Nick Treleaven wrote:
>>> /++/ - If we made /**/ nest, /++/ would be unnecessary
>>
>> I'd just drop nested comments: block comments and version(none)
>> are good enough.
>
> and i'll drop `*`. there is no reason to have multiply operator, we
> already have `+`!
Just submit an implementation of templated `+` to phobos
a +!5 b
;)
|
Copyright © 1999-2021 by the D Language Foundation