{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4441","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4441/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4441/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4441/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4441","id":97189348,"number":4441,"title":"Syntax suggestion: a real 'const' w/out historical bagage of 'static inline'","user":{"login":"raould","id":77176,"avatar_url":"https://avatars.githubusercontent.com/u/77176?v=3","gravatar_id":"","url":"https://api.github.com/users/raould","html_url":"https://github.com/raould","followers_url":"https://api.github.com/users/raould/followers","following_url":"https://api.github.com/users/raould/following{/other_user}","gists_url":"https://api.github.com/users/raould/gists{/gist_id}","starred_url":"https://api.github.com/users/raould/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raould/subscriptions","organizations_url":"https://api.github.com/users/raould/orgs","repos_url":"https://api.github.com/users/raould/repos","events_url":"https://api.github.com/users/raould/events{/privacy}","received_events_url":"https://api.github.com/users/raould/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/HaxeFoundation/haxe/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-07-25T04:34:20Z","updated_at":"2015-08-10T14:59:43Z","closed_at":null,"body":"When I read \"static inline\", it doesn't look at all like something meaning \"const\" other than by accident of the history of the compiler/syntax.\r\n\r\nAny time I want to write a 'constant' it is annoying laborious and not really to me at all clear from the syntax that it is making a constant. It is a common question by people new to Haxe why they have to use that syntax. To me it would be nice to find better UX for this use case. When I have a file that e.g. has all my video game constants in it, it is sad to see \"public static inline var\" so many times.\r\n\r\nIf \"static inline\" could be \"const\" or some such keyword, I dream that would be nicer syntax. I do not know what bad ramifications of such a change would be.\r\n\r\n```haxe\r\n  public static inline var MapEntityType:String = \"map\";\r\n  public static inline var TextEntityType:String = \"text\";\r\n  public static inline var PlayerEntityType:String = \"player\";\r\n  public static inline var ShotEntityType:String = \"shot\";\r\n  public static inline var CreatureEntityType:String = \"creature\";\r\n```\r\nvs.\r\n```haxe\r\n  public const var MapEntityType:String = \"map\";\r\n  public const var TextEntityType:String = \"text\";\r\n  public const var PlayerEntityType:String = \"player\";\r\n  public const var ShotEntityType:String = \"shot\";\r\n  public const var CreatureEntityType:String = \"creature\";\r\n```\r\n\r\nQuestions that come to my mind:\r\n* Should const == \"static inline\" or \"static inline var\"? What would \"const function\" mean?\r\n* While I appreciate the power of inlining, I do think it is orthogonal to const-ness.\r\n* I also think static is orthogonal to const-ness.\r\n\r\nSo I'd almost just want 'const' to not mean anything about inlining & staticness, only about something being \"final\" in the java sense. Note that this is different than e.g. (default,null) on properties.\r\n\r\nI realize that means people who want inline don't have to type much less in the new design, but I think it is a more clear statement of what is desired nevertheless.\r\n\r\nI am guessing that since these things are orthogonal, the \"static inline\" behaviour could be kept around for a while yet so code doesn't have to be ported immediately."},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/129482324","html_url":"https://github.com/HaxeFoundation/haxe/issues/4441#issuecomment-129482324","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4441","id":129482324,"user":{"login":"ousado","id":645241,"avatar_url":"https://avatars.githubusercontent.com/u/645241?v=3","gravatar_id":"","url":"https://api.github.com/users/ousado","html_url":"https://github.com/ousado","followers_url":"https://api.github.com/users/ousado/followers","following_url":"https://api.github.com/users/ousado/following{/other_user}","gists_url":"https://api.github.com/users/ousado/gists{/gist_id}","starred_url":"https://api.github.com/users/ousado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ousado/subscriptions","organizations_url":"https://api.github.com/users/ousado/orgs","repos_url":"https://api.github.com/users/ousado/repos","events_url":"https://api.github.com/users/ousado/events{/privacy}","received_events_url":"https://api.github.com/users/ousado/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T14:59:43Z","updated_at":"2015-08-10T14:59:43Z","body":"@back2dos \r\nregarding \"historical baggage\" (AKA general confusion) related to \"const-ness\":\r\nWe can start with your idea that the values of global constants (the ones we're talking about here)  are not required to be known at compile-time, which is flat out wrong for the vast majority of languages I'm aware of, which of course makes total sense, given the many optimization opportunities arising from that requirement."}}