Re: [PHP-DEV] New RFC about variables.
On Fri, 25 Jan 2019 at 10:32, Глеб Жуков wrote: > Hi, my name is Gleb Zhukov. > > In my RFC I want to propose to use a new entities(abstractions), like > *objects*, *structures* and *data* instead of variables. It gives such > advatege like a mental division of different, independent entities(objects, > structures, data) in any language. > Hi Gleb! This sounds a lot like how Perl uses "sigils" for different data types - $scalar, @array, %hash The problem with this in a complex language like PHP is that you soon run out of different characters for the different types you might want to represent. Note that your example already fails in this regard, because it suggests "#", which is already used for comments. When designing a language for the first time, it's an interesting thing to consider, but in an established language like PHP, it would be very disruptive, and I don't think it brings that much benefit. You can get almost the same thing in your own code by naming variables based on their type (so-called "Hungarian notation"). Regards, -- Rowan Collins [IMSoP]
Re: [PHP-DEV] New RFC about variables.
Is this a joke? pt., 25 sty 2019 o 11:32 Глеб Жуков napisał(a): > Hi, my name is Gleb Zhukov. > > In my RFC I want to propose to use a new entities(abstractions), like > *objects*, *structures* and *data* instead of variables. It gives such > advatege like a mental division of different, independent entities(objects, > structures, data) in any language. For example > > //If earlier we were using variables to store, or access objects, data and > everything else > > $object = new SomeClass(); > $array = ['one','two' => 'three']; > $data = 'string'; > > //Now we will use special "*object*" entities to store or access objects > (wich may be defined with # character) > > #object = new SomeClass(); > > //Special "*structure*" entities for arrays or any other structures (wich > may be defined with * character) > > *stucrture = ['one', 'two', 'key' => 'val', 'another_key' => > 'another_val']; > > //And special "*data*" entities for all data (strings, integers, floats, > booleans) (wich may be defined with % character) > > %string = 'abcde'; > %integer = 123; > %floating = 1.23; > %boolean = true; > > The remaining types(callables, resources), I suppose, should continue to > store in variables. New characters for our new entities will be discussed > further in RFC. > -- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com
[PHP-DEV] New RFC about variables.
Hi, my name is Gleb Zhukov. In my RFC I want to propose to use a new entities(abstractions), like *objects*, *structures* and *data* instead of variables. It gives such advatege like a mental division of different, independent entities(objects, structures, data) in any language. For example //If earlier we were using variables to store, or access objects, data and everything else $object = new SomeClass(); $array = ['one','two' => 'three']; $data = 'string'; //Now we will use special "*object*" entities to store or access objects (wich may be defined with # character) #object = new SomeClass(); //Special "*structure*" entities for arrays or any other structures (wich may be defined with * character) *stucrture = ['one', 'two', 'key' => 'val', 'another_key' => 'another_val']; //And special "*data*" entities for all data (strings, integers, floats, booleans) (wich may be defined with % character) %string = 'abcde'; %integer = 123; %floating = 1.23; %boolean = true; The remaining types(callables, resources), I suppose, should continue to store in variables. New characters for our new entities will be discussed further in RFC.