Poor arguments against
Poor arguments against
Posted Feb 18, 2015 8:08 UTC (Wed) by HelloWorld (guest, #56129)In reply to: Poor arguments against by mchapman
Parent article: Scalar typing in the PHP world
Not if the data structure happens to be cyclic, therefore it's an incomplet solution at best. Rust gets this right.
> Perl programmers know that this is the memory model perl uses, so they write their code accordingly;
That's the point, Perl programmers need to think about this sort of things, and this is exactly the kind of thing that a high-level language should relieve one of. Cycles can hide in very surprising places.
      Posted Feb 18, 2015 8:34 UTC (Wed)
                               by mchapman (subscriber, #66589)
                              [Link] (5 responses)
       
Yeah, so? All programming languages have required knowledge. 
Optimizing a language for new programmers is a losing strategy. You're only new to a language once. 
     
    
      Posted Feb 19, 2015 21:52 UTC (Thu)
                               by HelloWorld (guest, #56129)
                              [Link] (4 responses)
       
     
    
      Posted Feb 20, 2015 4:34 UTC (Fri)
                               by mathstuf (subscriber, #69389)
                              [Link] (3 responses)
       
     
    
      Posted Feb 20, 2015 5:50 UTC (Fri)
                               by nybble41 (subscriber, #55106)
                              [Link] (2 responses)
       
This is more about controlling the order of evaluation than managing memory. It isn't something which affects most programs, but it is something you have to be aware of when working in a non-strict language like Haskell, particularly when summarizing large data structures. Sometimes it works the other way, though; for example, `print (take 5 [1..])` requires constant memory (~1 list element) due to non-strict evaluation, whereas strict evaluation would demand infinite memory just to evaluate the `[1..]`. 
     
    
      Posted Feb 21, 2015 6:08 UTC (Sat)
                               by zlynx (guest, #2285)
                              [Link] (1 responses)
       
"No, it isn't a memory management problem. We just happened to completely redesign the object storage system to better manage object lifetimes." 
And you look at what they did and realize it would have been simpler to write it in C++. 
     
    
      Posted Feb 22, 2015 5:07 UTC (Sun)
                               by nybble41 (subscriber, #55106)
                              [Link] 
       
Anyway, the point was that the fundamental purpose of memory management is to recognize and free memory which will never be accessed throughout the remainder of the program so that it can be reused for new objects. In C++ all memory management is manual. Breaking cycles in Perl is something the programmer must do to ensure that unreachable objects get freed. That is low-level manual memory management. Redesigning an object storage system to better track object lifetimes is also memory management, albeit at a much higher level: an ideal garbage collector would recognize "reachable" objects which will in fact never be accessed regardless of the input and free them; manually removing the references is a hint necessitated by imperfect garbage collection. 
On the other hand, I would not consider modifying an algorithm to compute a result a different way to be memory management, even though it may have an effect on the amount of memory required. Changes in evaluation order can have a fundamental impact on the nature of the program, to the point of altering whether it's computable at all within finite time. This is not to say that managing the order of evaluation in Haskell is any less work than managing memory manually in C++, just that it doesn't come under the heading of memory management. The equivalent task in C++ would be designing the algorithm, though in C++ it's much more difficult to defer evaluation, and you're consequently less likely to consider that option. 
     
    Poor arguments against
      
Poor arguments against
      
This has nothing to do with being new to a language. It has to do with not solving a problem even though the solution is known and has been for decades. Anyway, I don't really care if you agree or not. A language that requires me to think about memory management is not high-level, period. 
Poor arguments against
      
Poor arguments against
      
Poor arguments against
      
Poor arguments against
      
 
           