什么情况| 什么叫文化| 灻是什么意思| 珞字五行属什么| 原位杂交技术检查什么| 桑枝是什么| 怀孕脸上长痘痘是什么原因| 肾动脉彩超主要查什么| 什么是香港脚| police是什么品牌| 水淀粉是什么东西| 2006属什么生肖| 汉朝后面是什么朝代| 咽喉发炎吃什么药| 贫血检查查什么项目| 空腹喝啤酒有什么危害| 知否知否应是绿肥红瘦什么意思| 卵泡不破是什么原因造成的| 五一年属什么生肖| 钙化结节是什么意思| 链球菌感染是什么病| 龙是什么命| 幅度是什么意思| 石榴红是什么颜色| 养肝护肝喝什么茶最好| 辅酶q10什么价格| 缺铁有什么症状| 心脾两虚吃什么中成药| 踮脚尖有什么好处| 槲皮素是什么东西| 一个令一个瓦念什么| 清朝为什么会灭亡| 一个木一个号念什么| 男人腰疼是什么原因| 草龟吃什么蔬菜| 炎症是什么| 心肌供血不足是什么原因造成的| 脚凉吃什么药| 正畸和矫正有什么区别| 爱情和面包是什么意思| 女性吃辅酶q10有什么好处| 植物神经功能紊乱吃什么药| 一什么珍珠| burberry是什么牌子| 流鼻血去药店买什么药| 女性耻骨疼是什么原因| 女生学什么专业好| 病理切片是什么意思| 吃什么补血效果最好| 肾囊肿有什么症状表现| 东方为什么红| 备孕需要做什么检查| 高密度脂蛋白胆固醇是什么意思| 1946属什么生肖| 我用什么才能留住你| 人工虎骨粉是什么做的| 靠谱什么意思| 1222是什么星座| 台湾什么时候统一| 人流后吃什么最补子宫| 马弁是什么意思| 晚上9点半是什么时辰| 扁平疣是什么原因造成的| 地格是什么意思| 司是什么级别| 冰火两重天什么意思| 快餐是什么意思| 什么地躺着| 胎记长什么样| 难为情是什么意思| 胆囊结石挂什么科| 运动后喝什么水最好| 甲亢在中医里叫什么病| mir是什么检查| 饭后胃胀是什么原因导致的| 马甲线长什么样| 脾虚如何调理吃什么药| 柏拉图爱情是什么意思| 痔疮是什么样子的图片大全| 五月二十日是什么星座| 3月10日是什么星座| 那天离开你是什么歌| 水满则溢月盈则亏是什么意思| 6月28是什么星座| 可乐饼为什么叫可乐饼| 做什么梦暗示你怀孕了| 总做梦是什么原因| 抗原体阳性是什么意思| 恒字属于五行属什么| 跛脚是什么意思| 0mg是什么意思| 牛肉饺子配什么菜好吃| 女人颧骨高有什么说法| 南辕北辙是什么故事| 姐姐的女儿应该叫什么| 尿茶色尿是什么原因| 欺世盗名是什么意思| 梦见去扫墓是什么预兆| 京东自营店是什么意思| 1997年的牛是什么命| 为什么刚吃完饭不能洗澡| 痛风反复发作什么原因| 杏干泡水喝有什么功效| 有什么含义| dcdc是什么意思| 梦见虱子是什么意思| 婚姻是爱情的坟墓是什么意思| 淡奶油是什么| 好梦是什么意思| 请佛像回家有什么讲究| 尿胆红素阳性什么意思| 网络绿茶是什么意思| 荨麻疹是由什么引起的| 天秤和什么星座最配| 梦见菊花是什么意思啊| 主意正是什么意思| 冲虎煞南是什么意思| 耳朵里面痒用什么药| 嘴里发咸是什么原因| 尿道感染是什么原因引起的| 疤痕憩室什么意思| 换床有什么讲究| 牢固的近义词是什么| 高血压吃什么降的快| 现在的节气是什么| 主动脉钙化什么意思| 属龙五行属什么| 饸饹是什么| 第一次见面送女生什么花| 口苦吃什么药最有效| 20点是什么时辰| 开门是什么意思| 速度是70迈心情是自由自在什么歌| 什么是国企| 烫伤忌口不能吃什么| 月经时间过长是什么原因引起的| 电焊打眼睛用什么眼药水| 伤风是什么意思| 绣球花什么时候修剪| 什么是目标| 上飞机不能带什么| 脾虚湿盛吃什么中成药| 洁身自爱是什么意思| 溺爱的意思是什么| 眼睛干涩吃什么食物好| 红色爱心是什么牌子| 紧急避孕药什么时候吃有效| 仓鼠可以吃什么蔬菜| 诺欣妥是什么药| 胸有成竹是什么意思| 今年53岁属什么生肖| 丑指什么生肖| 亦什么意思| 脂肪肝有什么危害| 失眠吃什么中药调理效果快| 流连忘返的返是什么意思| 孕妇早上吃什么早餐好| 去医院看嘴唇挂什么科| 宫保鸡丁属于什么菜系| 什么叫支原体感染| 办理护照需要什么手续| 再生纤维是什么面料| 什么鱼嘌呤含量低| 梅毒是什么症状图片| 为什么呢| 官官相护是什么意思| 冠心病什么症状表现| 咖啡烘培度有什么区别| 酮症酸中毒什么原因引起的| 周二右眼皮跳是什么预兆| 09年的牛是什么命| 头晕吃什么药| 医院为什么不推荐腹膜透析| 为什么空调不制冷| 小暑是什么意思啊| 1800年是什么朝代| 抑郁什么意思| 脑梗阻有什么症状| 气血不足吃什么药最好| 杨过是什么生肖| 小时的单位是什么| 心肌缺血吃什么食物| 透明隔间腔是什么意思| 九夫痣是什么意思| 990是什么意思| 蟋蟀用什么唱歌| 梦见衣服是什么意思| 阴茎瘙痒是什么原因| 昱念什么| 嘴甜是什么原因| 1.18是什么星座| 什么叫磁场| 过氧化氢浓度阳性是什么意思| 为什么会血糖高| 6月11号是什么星座| 6月16日是什么星座| 三月三是什么星座| 林彪为什么反革命| 头晕是什么原因引起| 非甾体抗炎药是什么意思| 胆囊炎可以吃什么| 父亲节做什么礼物好| 怀孕前三个月需要注意什么| 不吃肉对身体有什么影响| 体重除以身高的平方是什么指数| 好马不吃回头草是什么意思| 为什么人一瘦就会漂亮| 梦到和妈妈吵架是什么意思| 肺炎衣原体和支原体有什么区别| pbs是什么| 1103是什么星座| 为什么当警察| 水疗是什么| 学名是什么意思| 金针菇炒什么好吃| 吃什么水果能美白| 关税是什么| 十恶不赦是什么意思| 梦见上班迟到什么意思| 脖子疼是什么原因引起的| 洗衣机启动不了是什么原因| 78岁属什么生肖| 女人烂桃花多说明什么| 为什么总是放屁很频繁| 运费险是什么意思| 焦虑症吃什么中成药| 什么药降糖效果最好| 萎缩性胃炎吃什么水果好| 细胞是什么| 下属是什么意思| 男士蛋皮痒用什么药| 2018年属什么生肖| 清洁度iv是什么意思| 84年属于什么生肖| 神助攻什么意思| 牙龈萎缩吃什么维生素| 宗人府是什么地方| 医院附近适合做什么生意| 下午两点属于什么时辰| 舌苔发白吃什么药| 吃什么能降血压最有效| 胆汁反流用什么药好| 三维和四维有什么区别| 胆汁反流什么症状| 妇科臭氧治疗是什么| gf是什么单位| 唇系带断了有什么影响| 蚯蚓用什么呼吸| 蛇鼠一窝是什么意思| 伤官伤尽是什么意思| 手指甲软薄是缺什么| 男性射精是什么感觉| 肩周炎挂什么科| 什么是人彘| 什么补肾壮阳最好| 小腿红肿是什么原因引起的| 桃胶是什么东西| 做梦吃肉是什么征兆| 固执己见是什么意思| 晚上减肥吃什么| 小孩疝气看什么科室| 为什么会经常流鼻血| aqi是什么意思| 梦见拖地是什么意思| 百度
rfc:reserve_primitives

染宝怎么注册_染宝如何登录_染宝赚钱最新入口

百度 第十三届全国人大常委会副委员长。

This RFC would like to discuss options for reserving primitive type names int, integer, float, double, bool, boolean and string.

Introduction

Reserving the names as suggested e.g. by the scalar types hints RFC will create problems if people have used them as class, interface or trait names. Creating BC problems slows adoption, so they should be outweighed with benefits.

Proposal

The motivation for reserving the names stems from a possible ambiguity allowing them would create.

class int { ... }
 
function sum(int $a, int $b): int { ... }

In this case, it's not clear what the int in the method signature stands for: PHP's native primitive or the userland class?

Using the above is a bit unfair towards the real-life situation: The majority of frameworks in PHP nowaday uses a) namespaces and b) would capitalize the type name, giving us:

namespace types;
 
class Int { ... }
 
// ... another file:
function sum(\types\Int $a, \types\Int $b): \types\Int { ... }
 
// ... yet another file:
use types\Int;
 
function sum(Int $a, Int $b): Int { ... }

Purely looking from a reader's perspective, the first example is surely not to be confused with anything that is a primitive. For the second example, it's a bit harder to judge, though to me personally, it would still be OK.

The options this RFC suggests discussing are:

Option 1: Reserve

This first option suggests reserving primitive type names.

  • BC break: No global class, interface or trait can be named after a primitive type name.
  • BC break: No namespaced class, interface or trait can be named after a primitive type name.
  • BC break: No class, interface or trait named after a primitive name can be imported with use

Option 2: Allow namespaced

This second option suggests allowing primitive type names in combination with namespaces, but disallowing them in global scope.

  • BC break: No global class, interface or trait can be named after a primitive type name
  • BC break: No class, interface or trait named after a primitive name can be imported with use

The following would work:

namespace types;
 
class Int { ... }
 
// ... another file:
function sum(\types\Int $a, \types\Int $b): \types\Int { ... }

Option 3: Allow namespaces and use

This would allow primitive type names in combination with namespaces, and accept imports, overriding primitive definitions.

  • BC break: No class, interface or trait in the global namespace can be named after a primitive type name

The following would work:

namespace types;
 
class Int { ... }
 
// ... another file:
use types\Int;
 
function sum(Int $a, Int $b): Int { ... }

To the reader, it's *probably* clear because of the uppercasing. If a lowercase class was used, this would be confusing. Looking at real-life frameworks and libraries, we'd usually find the first case.

Option 4: Case insensitivity exception

This option would add special handling to the primitive types names and allow all situations in which a different casing was used.

  • BC break: No class, interface or trait in the global namespace can be named *exactly* after a primitive type name

Or, in code:

class int { }  // Parse error: Cannot use primitive type name "int"
class Int { }  // OK

Option 5: Use cast-tokens

This would make any situation unambigous, reuse already existing parser tokens, and create no BC breaks:

// The primitive
function sum((int) $a, (int) $b): (int) { ... }
 
// Always the int class
function sum(\types\Int $a, \types\Int $b): \types\Int { ... }
function sum(Int $a, Int $b): Int { ... }
function sum(int $a, int $b): int { ... }

Fair enough, this is counter-intuitive to the syntax used so far for arrays and callables as well as for value types; and the majority of other programming languages.

Option 6: Do not reserve

The type names would not be reserved. No BC breaks occur, while it's also not possible to use them for parameter and return type hints. For both situations, alternative suggestions, e.g. along a “design by contract” RFC are discussed.

Proposed PHP Version(s)

PHP 7.0

RFC Impact

In all situations except the last two options, reserving primitive type names causes a BC break. The options above sketch out how we can cope with this, balancing the usefulness of being able to use these tokens and backwards compatibility on the other side.

These frameworks would be affected by reserving the word “string” (incomplete list):

  • CakePHP - lib/Cake/Utility/String.php
  • Joomla - src/Joomla/Filesystem/Stream/String.php
  • ZF2 - library/Zend/XmlRpc/Value/String.php
  • Drupal8 - core/lib/Drupal/Component/Utility/String.php
  • XP Framework - src/main/php/lang/types/String.class.php

This code search for a PHP String class suggests various more libraries will be affected. Same goes for “Boolean”, “Integer”, “Int”, “Float” and “Double”

Future Scope

Extend these rules to resource and the pseudo-type mixed, as well as possibly even array and callable.

Proposed Voting Choices

Voting on options to give the discussion a direction.

Patches and Tests

(TODO)

Implementation

(TODO)

References

Rejected Features

(TODO)

rfc/reserve_primitives.txt · Last modified: by 127.0.0.1

?
蚱蜢吃什么食物 月经期体重增加是什么原因 老夫聊发少年狂什么意思 金兰之交是什么意思 吃什么容易排大便
海关是什么 忧愁是什么意思 左舌根疼痛是什么情况 牙龈紫色是什么原因 什么叫野鸡大学
为什么打嗝不停 爬山带什么食物比较好 阴茎是什么 拖鞋买什么材质的好 吃了小龙虾不能吃什么
听吧新征程号角吹响是什么歌 肌酐300多属于什么期 别出心裁什么意思 阴历3月是什么星座 子字五行属什么
腊肠炒什么好吃hcv9jop1ns2r.cn 荔枝什么季节成熟hcv8jop2ns2r.cn 中药饮片是什么hcv9jop7ns0r.cn 结节有什么症状hcv7jop4ns5r.cn 病毒五项检查的是什么hcv9jop7ns0r.cn
4月9日什么星座hcv9jop6ns5r.cn 意图是什么意思hcv8jop4ns1r.cn 福五行属什么hcv9jop6ns9r.cn 维生素c对身体有什么好处jasonfriends.com 空调输入功率是什么意思hcv7jop9ns3r.cn
徐峥的老婆叫什么名字hcv9jop2ns1r.cn 肝右叶钙化灶是什么意思hcv9jop3ns4r.cn dbm是什么单位hcv9jop2ns1r.cn 多愁善感是什么意思hcv9jop5ns4r.cn 癃闭什么意思hcv9jop5ns3r.cn
三点水一个分读什么hcv8jop9ns5r.cn 脾阳不足吃什么中成药hcv9jop2ns6r.cn 什么叫割礼hcv9jop6ns7r.cn 维生素e有什么功效hcv8jop0ns3r.cn 蒲公英的花是什么颜色hcv7jop9ns9r.cn
百度