home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,794 of 264,096   
   Michael S to Dan Cross   
   Re: Unsafe code blocks   
   19 Nov 25 19:29:53   
   
   From: already5chosen@yahoo.com   
      
   On Wed, 19 Nov 2025 16:12:32 -0000 (UTC)   
   cross@spitfire.i.gajendra.net (Dan Cross) wrote:   
      
   > In article <10fig54$1n41a$3@dont-email.me>,   
   > Arne Vajh_žj   wrote:   
   > >On 11/18/2025 2:04 PM, Arne Vajh_žj wrote:     
   > >> On 11/15/2025 9:16 PM, Dan Cross wrote:     
   > >>>> Also note the availability of the 'Valid attribute to make sure   
   > >>>> that what   
   > >>>> is in the variable after the unsafe conversion is actually a   
   > >>>> valid value.     
   > >>>   
   > >>> Sum types make this trivial:   
   > >>>   
   > >>> _ _ _ _  impl SomeType {   
   > >>> _ _ _ _ _ _ _ _  fn try_from(i: i32) -> Option {   
   > >>> _ _ _ _ _ _ _ _ _ _ _ _  // if valid, return `Some(whatever`),   
   > >>> _ _ _ _ _ _ _ _ _ _ _ _  // else return `None`.   
   > >>> _ _ _ _ _ _ _ _  }   
   > >>> _ _ _ _  }     
   > >> (assuming Option in Rust is what it is in other languages)   
   > >>    
   > >> Option and Ada Valid are somewhat different.   
   > >>    
   > >> Option is a way for a function/method to either return   
   > >> a value or return the fact that there is no value.   
   > >>    
   > >> A much better way to do that than traditional   
   > >> return null or -1 or whatever to indicate there   
   > >> is no value.   
   > >>    
   > >> Ada valid attribute is a runtime check on the result from   
   > >> an unsafe conversion to see if it meets the constraints   
   > >> of the data type.     
   > >   
   > >Option is in fashion in recent years.     
   >    
   > Algebraic data types have been used in functional languages   
   > since the 1970s, starting with the "Hope" language from   
   > Edinburgh.  ML took them from Hope and popularized them, and   
   > they leaked into Miranda, Haskell, and OCaml from there.  Now   
   > many languages support them; even C++ (`std::optional`).   
   >    
   > Hope was first described in a paper in 1980, but the work of   
   > course predated that.   
   >    
   > That makes them about as old as VMS, and older than Ada.  In   
   > other words, they've been "In Fashion" since the 70s,   
      
   That does not follow.   
   Something existing for a long time is not the same as being fashionable   
   for a long time.   
   Options became fashionable relatively recently, as result of growing   
   dissatisfaction with previous fashionable item - exceptions.   
   Parts of programming community that are less concerned with fashion of   
   the day ignored both of this things. They use error codes, either in   
   crude form (like C) or more refined (like Go).   
      
   > which as   
   > far as all things fashion goes, is a pretty good run;   
   > particularly considering some of the things that were popular in   
   > that decade.   
   >    
   > >There are not that many languages on VMS supporting   
   > >Option.   
   > >   
   > >Scala does - Option[T].   
   > >   
   > >And Java 8 Optional is almost the same.     
   >    
   > More's the pity.   
   >    
   > 	- Dan C.   
   >    
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca