Project

General

Profile

Bug #10708

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

Consider this: 

 ~~~ruby 
 
     def foo; end 
 
     foo(*[]) #Splatting an empty list is ok 
 
     foo(**{}) #Double splatting an empty hash is like calling foo({}) which gives an error 
 ~~~ 

 This is annoying in a function that is a wrapper around another function and just process some keywords: 

 ~~~ruby 
 
     def wrapper(*args, keyword: true, **others) 
   
       puts keyword 
   
       wrappee(*args,**others) #here this code will fail if others is empty 
 
     end 
 ~~~ 

Back