removal of cruft from D

Bill Baxter wbaxter at gmail.com
Fri Nov 20 16:01:12 PST 2009


On Fri, Nov 20, 2009 at 3:53 PM, Justin Johansson <no at spam.com> wrote:
> Bill Baxter wrote:
>>
>> On Fri, Nov 20, 2009 at 3:37 PM, Justin Johansson <no at spam.com> wrote:
>>>
>>> Bill Baxter wrote:
>>>>
>>>> On Fri, Nov 20, 2009 at 3:10 PM, Lars T. Kyllingstad
>>>> <public at kyllingen.nospamnet> wrote:
>>>>>
>>>>> Nick Sabalausky wrote:
>>>>>>
>>>>>> "Yigal Chripun" <yigal100 at gmail.com> wrote in message
>>>>>> news:he6sqe$1dqu$1 at digitalmars.com...
>>>>>>>
>>>>>>> Based on recent discussions on the NG a few features were
>>>>>>> deprecated/removed from D, such as typedef and C style struct
>>>>>>> initializers.
>>>>>>>
>>>>>>> IMO this cleanup and polish is important and all successful languages
>>>>>>> do
>>>>>>> such cleanup for major releases (Python and Ruby come to mind). I'm
>>>>>>> glad to
>>>>>>> see that D follows in those footsteps instead of accumulating craft
>>>>>>> like C++
>>>>>>> does.
>>>>>>>
>>>>>>>
>>>>>>> As part of this trend of cleaning up D before the release of D2, what
>>>>>>> other features/craft should be removed/deprecated?
>>>>>>>
>>>>>>> I suggest reverse_foreach and c style function pointers
>>>>>>>
>>>>>>> please add your candidates for removal.
>>>>>>>
>>>>>> s/reverse_foreach/foreach_reverse/ ;)
>>>>>>
>>>>>> 1. Floating point literals without digits on *both* sides!!! "1.",
>>>>>> ".1"
>>>>>> --> Useless hindrance to future language expansion!
>>>>>>
>>>>>> 2. Octal literals! I think it'd be great to have a new octal syntax,
>>>>>> or
>>>>>> even better, a general any-positive-inter-base syntax. But until that
>>>>>> finally happens, I don't want "010 == 8" preserved. And I don't think
>>>>>> the
>>>>>> ability to have an octal literal is important enough that lacking it
>>>>>> for
>>>>>> a
>>>>>> while is a problem. And if porting-from-C really has to be an issue,
>>>>>> then
>>>>>> just make 0[0-9_]+ an error for a transitionary period (or forever -
>>>>>> it'd at
>>>>>> least be better than maintaining "010 == 8").
>>>>>
>>>>> It would definitely be a problem if octal literals disappeared from the
>>>>> language, even if only for a short while. They are pretty much the only
>>>>> sensible way to specify POSIX file permissions.
>>>>>
>>>>>  import core.sys.posix.sys.stat;
>>>>>  ...
>>>>>  chmod("path/to/file", 0755);
>>>>
>>>> Well you can always do..
>>>>
>>>> chmod("path/to/file", octal(755));
>>>>
>>>> --bb
>>>
>>> octal(755)?
>>>
>>> What's the base-10 identity of that?
>>>
>>> decimal(493) or decimal(755)?
>>>
>>> base-16 etc.
>>
>> Fine.  Make it octal!"755" if you prefer.
>> The point is just that you can write a function that will convert a
>> number to octal for the rare cases when you need it.
>> You don't absolutely need octal literals.
>>
>> --bb
>
> Thanks for clarifying your position;
> I can happily go along with that. :-)
> (Sorry if at all I sounded obtuse or curt).

You were right, though.  Defining octal(x) that way would be a bad idea.  :-)
octal(0x755)  --> what now?
base11(999) --> ok but how you gonna do base11(AAA)?
binary(10101010101010101) ...  overflows a uint argument.

--bb



More information about the Digitalmars-d mailing list