www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - depreciated function delete

reply alik <mammadov.ali ideal.az> writes:
Hi there. as you know delete function is depreciated. so I tried 
to use the __delete function for the code below:

if (this.parse_buffer.length > this.parse_size)
			{
				__delete(this.parse_buffer);
				this.parse_buffer.length = this.parse_size;
			}


but in return after I compile code I get the error like : 
Undefined identifier.
when I use destroy instead I don't get any errors. but I want to 
use __delete because of the garbage collector as it frees up the 
memory

thanks in advance.
Jan 18 2019
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/18/19 3:48 PM, alik wrote:
 Hi there. as you know delete function is depreciated. so I tried to use 
 the __delete function for the code below:
 
 if (this.parse_buffer.length > this.parse_size)
              {
                  __delete(this.parse_buffer);
                  this.parse_buffer.length = this.parse_size;
              }
 
 
 but in return after I compile code I get the error like : Undefined 
 identifier.
 when I use destroy instead I don't get any errors. but I want to use 
 __delete because of the garbage collector as it frees up the memory
 
 thanks in advance.
import core.memory: __delete; -Steve
Jan 18 2019
parent reply Ali <mammadov.ali ideal.az> writes:
On Friday, 18 January 2019 at 21:13:34 UTC, Steven Schveighoffer 
wrote:
 On 1/18/19 3:48 PM, alik wrote:
 Hi there. as you know delete function is depreciated. so I 
 tried to use the __delete function for the code below:
 
 if (this.parse_buffer.length > this.parse_size)
              {
                  __delete(this.parse_buffer);
                  this.parse_buffer.length = this.parse_size;
              }
 
 
 but in return after I compile code I get the error like : 
 Undefined identifier.
 when I use destroy instead I don't get any errors. but I want 
 to use __delete because of the garbage collector as it frees 
 up the memory
 
 thanks in advance.
import core.memory: __delete; -Steve
thank you for your quick answer. I did it for my own files but should I change something in here : /root/.dub/packages/undead-1.0.9/undead/src/undead/regexp.d(370,17): Deprecation: The delete keyword has been deprecated. Use object.destroy() (and core.memory.GC.free() if applicable) instead.
Jan 18 2019
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/18/19 4:32 PM, Ali wrote:
 On Friday, 18 January 2019 at 21:13:34 UTC, Steven Schveighoffer wrote:
 On 1/18/19 3:48 PM, alik wrote:
 Hi there. as you know delete function is depreciated. so I tried to 
 use the __delete function for the code below:

 if (this.parse_buffer.length > this.parse_size)
              {
                  __delete(this.parse_buffer);
                  this.parse_buffer.length = this.parse_size;
              }


 but in return after I compile code I get the error like : Undefined 
 identifier.
 when I use destroy instead I don't get any errors. but I want to use 
 __delete because of the garbage collector as it frees up the memory

 thanks in advance.
import core.memory: __delete;
thank you for your quick answer. I did it for my own files but should I change something in here : /root/.dub/packages/undead-1.0.9/undead/src/undead/regexp.d(370,17): Deprecation: The delete keyword has been deprecated.  Use object.destroy() (and core.memory.GC.free() if applicable) instead.
Yeah that should be updated to use __delete, feel free to submit a PR, or raise an issue. -Steve
Jan 18 2019
parent Ali <mammadov.ali ideal.az> writes:
On Friday, 18 January 2019 at 21:37:38 UTC, Steven Schveighoffer 
wrote:
 On 1/18/19 4:32 PM, Ali wrote:
 On Friday, 18 January 2019 at 21:13:34 UTC, Steven 
 Schveighoffer wrote:
 On 1/18/19 3:48 PM, alik wrote:
 Hi there. as you know delete function is depreciated. so I 
 tried to use the __delete function for the code below:

 if (this.parse_buffer.length > this.parse_size)
              {
                  __delete(this.parse_buffer);
                  this.parse_buffer.length = this.parse_size;
              }


 but in return after I compile code I get the error like : 
 Undefined identifier.
 when I use destroy instead I don't get any errors. but I 
 want to use __delete because of the garbage collector as it 
 frees up the memory

 thanks in advance.
import core.memory: __delete;
thank you for your quick answer. I did it for my own files but should I change something in here : /root/.dub/packages/undead-1.0.9/undead/src/undead/regexp.d(370,17): Deprecation: The delete keyword has been deprecated.  Use object.destroy() (and core.memory.GC.free() if applicable) instead.
Yeah that should be updated to use __delete, feel free to submit a PR, or raise an issue. -Steve
did it but now it shows me another deprecated functions: Deprecation: Symbol object.string is not visible from module math because it is privately imported in module string Deprecation: foreach: loop index implicitly converted from size_t to int /root/.dub/packages/undead-1.0.9/undead/src/undead/socketstream.d(124,32): Deprecation: undead.socketstream.SocketStream.seek cannot be annotated with disable because it is overriding a function in the base class instead of disable I dont have any idea what to use.
Jan 18 2019