{"id":20806862,"url":"https://github.com/pleclech/haxe-const","last_synced_at":"2026-02-20T01:01:47.962Z","repository":{"id":24620278,"uuid":"28029226","full_name":"pleclech/haxe-const","owner":"pleclech","description":"Constants implemented for Haxe language with help of abstracts","archived":false,"fork":false,"pushed_at":"2014-12-15T09:28:06.000Z","size":123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T03:41:51.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pleclech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-15T09:17:48.000Z","updated_at":"2016-02-16T14:03:04.000Z","dependencies_parsed_at":"2022-07-23T05:16:22.867Z","dependency_job_id":null,"html_url":"https://github.com/pleclech/haxe-const","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pleclech/haxe-const","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleclech%2Fhaxe-const","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleclech%2Fhaxe-const/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleclech%2Fhaxe-const/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleclech%2Fhaxe-const/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pleclech","download_url":"https://codeload.github.com/pleclech/haxe-const/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleclech%2Fhaxe-const/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29637916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T19:27:41.094Z","updated_at":"2026-02-20T01:01:47.920Z","avatar_url":"https://github.com/pleclech.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"haxe-const\n==========\n\nConstants implemented for Haxe language with help of abstracts\u003cbr\u003e\nMaybe you want macro version instead?\n\n\u003ca href=\"http://peyty.github.io#donate\"\u003e\u003cimg src=\"http://peyty.github.io/images/donate.png\"\u003e\u003c/a\u003e\n\u003ca href=\"http://peyty.github.io#hireme\"\u003e\u003cimg src=\"http://peyty.github.io/images/hireme.png\"\u003e\u003c/a\u003e\n\nInstallation \u0026 Usage\n=====\nQuick install:\n```\nhaxelib git haxeconst https://github.com/PeyTy/haxe-const.git\n```\nQuick update:\n```\nhaxelib update haxeconst\n```\nAdd to build.hxml:\n```\n-lib haxeconst\n```\nNo ```import``` required if you use OOP syntax: ```var c = new Const(value);```\nFor short functional syntax, use  ```import Const.Tools.const;``` and then ```var c = const(value);```\n\nJust create instance of Const class or use function ```const``` from ```import Const.Tools.const;```:\n\n```haxe\n// Ints:\nvar c = const(56);\n// same as:\nvar c = new Const(56);\n// c = 7; error!\n// c++; error! No A++ ++A A-- --A for consts!\nvar x:Int = c;\ntrace(c+1);\ntrace(c*10);\ntrace(c/10);\ntrace(c-1);\ntrace(1-c);\n\n// Floats:\nvar c = new Const(56.65);\n// c = 123.456; error!\nvar x:Float = c;\ntrace(c+1);\ntrace(c*10);\ntrace(c/10.0);\ntrace(c-1);\n\n// Strings:\nvar s = new Const(\"hello\");\n// s = \"string\"; error!\ntrace(s);\ntrace(s.length);\n\n// Arrays:\nvar a = new Const([1,2,3]);\n// a = [1]; error!\na.push(4);\ntrace(a);\ntrace(a.length);\nvar ar:Array\u003cInt\u003e = a;\n\n// Anything:\n\nclass Demo {\n\tpublic var a:Int = 100;\n\tpublic var b = new Const({ hello : \"hi!\" });\n}\n\nvar demo = new Const(new Demo());\n// demo = new Demo(); error!\n// demo.b = { hello : \"um?\" }; error!\ntrace(demo);\ntrace(demo.a);\ndemo.a = 101;\ntrace(demo.b.hello);\ndemo.b.hello = \"hi-hi\";\n```\n\nHacking Consts (can be useful)\n=====\n```haxe\n// The Only Hack =)\ndemo = new Const(new Demo()); // where demo -\u003e already instantiated Const\n\n// Function arguments:\nfunction test(const:Const\u003cInt\u003e){\n\t// const = 7; error!\n\ttrace(const); // 42 OK\n}\ntest(new Const(42));\n```\n\nKnown Bugs *!need help!*\n=====\n```haxe\n// Ints:\nvar c = new Const(56);\nvar x:Int = c;\ntrace(x+c); // bug\ntrace(-c); // bug\n```\n\n```haxe\n// Floats:\nvar c = new Const(56.65);\nvar x:Float = c;\ntrace(x-c); // bug\ntrace(x+c); // bug\ntrace(-c); // bug\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpleclech%2Fhaxe-const","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpleclech%2Fhaxe-const","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpleclech%2Fhaxe-const/lists"}