Thread overview | |||||
---|---|---|---|---|---|
|
December 10, 2003 delete on arrays and associative arrays | ||||
---|---|---|---|---|
| ||||
Using delete on an associative array will remove the element and resize the array . Using delete on a dynamic ( or otherwise ) array will just leave a blank spot in the middle of the array, not resizing. Could we have a 'remove' property that will remove the element , and resize the array ? I think this would go along way to help make the language more consistent and useful. C |
December 10, 2003 Re: delete on arrays and associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Sanders | I suggest array and other language primitives which can be expressed as structs get their place as structs in the standard library. Some syntax would translate to certain methods, but also all other methods and propeties should be acessible directly. A compiler switch or inifile setting should specify in which namespace to look for definitions. This would allow the Standard Library group to enhance basic types. -eye In article <br7v4r$1lki$1@digitaldaemon.com>, Charles Sanders says... > >Using delete on an associative array will remove the element and resize the array . > >Using delete on a dynamic ( or otherwise ) array will just leave a blank spot in the middle of the array, not resizing. > >Could we have a 'remove' property that will remove the element , and resize the array ? > >I think this would go along way to help make the language more consistent and useful. > > >C > > |
December 12, 2003 Re: delete on arrays and associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | Ilya Minkov wrote:
>I suggest array and other language primitives which can be expressed as structs
>get their place as structs in the standard library. Some syntax would translate
>to certain methods, but also all other methods and propeties should be acessible
>directly. A compiler switch or inifile setting should specify in which namespace
>to look for definitions.
>
>This would allow the Standard Library group to enhance basic types.
>
>-eye
>
>In article <br7v4r$1lki$1@digitaldaemon.com>, Charles Sanders says...
>
>
>>Using delete on an associative array will remove the element and resize the
>>array .
>>
>>Using delete on a dynamic ( or otherwise ) array will just leave a blank
>>spot in the middle of the array, not resizing.
>>
>>Could we have a 'remove' property that will remove the element , and resize
>>the array ?
>>
>>I think this would go along way to help make the language more consistent
>>and useful.
>>
>>
>>C
>>
>>
>>
>>
>
>
>
Parhaps something like:
extend int
{
void remove(...) ...
}
Allowing anyone to add methods to the standard primitive (it could be used for classes as well but then it might take the place of inheritance).
PS - I suggested this before for operator overloading, for the _r side, before it was implemented.
|
Copyright © 1999-2021 by the D Language Foundation