| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Rewrite all sources to align with Cangjie 1.1.3 stdlib APIs This is a major rewrite. The previous 0.1.0 sources were authored without access to a Cangjie 1.1.3 SDK and contained a number of mistakes (std.core.Environment.argv does not exist, std.process API shape was wrong, a hand-rolled atomic module was added that the stdlib does not provide, etc.). This commit fixes every file against the stdlib surface documented at docs.cangjie-lang.cn. Core changes ------------ * main is now declared as main(args: Array<String>): Int64; argv is the parameter, NOT std.core.Environment.argv. * The AtomicBool / AtomicRef / tomic_fence shim is gone. The server is single-threaded by design and uses a plain ar Bool for the initialised flag. * class Foo <: Exception initialisers are now first-class — all public let fields are assigned in the primary init that calls super(...). * Option<T> is the only nullable type. None is a variant of Option, not a top-level name imported from std.core. * match no longer supports tuple destructuring on the right-hand side of let; the code uses a plain local + a nested match. * std.process.executeWithOutput(command, args, cwd, env, ...) replaces the old Process.run(...) static-method shape. Files touched ------------ * src/main.cj, src/cli.cj, src/lib.cj * src/core/{error,jsonx,log,protocol,server,tool,transport,registry}.cj * src/knowledge/{api_index,explain,loader,patterns}.cj * src/tools/{cjapi,cjdoc,cjfmt,cjlint,cjpm,explain,patterns,pkgsearch,scaffold,fs}.cj * test/core/{error,jsonx,protocol,registry}_test.cj * test/knowledge/api_index_test.cj * test/tools/tools_test.cj * test/integration/server_test.cj * example/{minimal,full}/src/main.cj * benchmark/src/main.cj Verification ------------ This commit does NOT include a cjpm build pass because the authoring environment has no Cangjie 1.1.3 SDK installed. The rewrite was driven by: 1. The published 1.1.3 docs at docs.cangjie-lang.cn (main signature, std.process API, std.io file APIs, std.net HttpClient.get). 2. The cj-codelabs/docs sample projects (a-la cjpm / cjlint). 3. Manual code review of every file by the author. A maintainer with the SDK should run cjpm update && cjpm build and cjpm test to confirm. The most likely remaining issues are: * std.io.InputStream.stdin() / OutputStream.stdout() — the stdin/stdout static accessors exist on std.env in some versions; substitute if the compiler complains. * std.fs.Path(...) constructor — exists in 1.1.3 but the field shape differs from earlier versions. * ByteReader.read(buf: Array<UInt8>) — argument shape may need a slice or a different overload depending on the SDK. | 1 个月前 | |
Rewrite all sources to align with Cangjie 1.1.3 stdlib APIs This is a major rewrite. The previous 0.1.0 sources were authored without access to a Cangjie 1.1.3 SDK and contained a number of mistakes (std.core.Environment.argv does not exist, std.process API shape was wrong, a hand-rolled atomic module was added that the stdlib does not provide, etc.). This commit fixes every file against the stdlib surface documented at docs.cangjie-lang.cn. Core changes ------------ * main is now declared as main(args: Array<String>): Int64; argv is the parameter, NOT std.core.Environment.argv. * The AtomicBool / AtomicRef / tomic_fence shim is gone. The server is single-threaded by design and uses a plain ar Bool for the initialised flag. * class Foo <: Exception initialisers are now first-class — all public let fields are assigned in the primary init that calls super(...). * Option<T> is the only nullable type. None is a variant of Option, not a top-level name imported from std.core. * match no longer supports tuple destructuring on the right-hand side of let; the code uses a plain local + a nested match. * std.process.executeWithOutput(command, args, cwd, env, ...) replaces the old Process.run(...) static-method shape. Files touched ------------ * src/main.cj, src/cli.cj, src/lib.cj * src/core/{error,jsonx,log,protocol,server,tool,transport,registry}.cj * src/knowledge/{api_index,explain,loader,patterns}.cj * src/tools/{cjapi,cjdoc,cjfmt,cjlint,cjpm,explain,patterns,pkgsearch,scaffold,fs}.cj * test/core/{error,jsonx,protocol,registry}_test.cj * test/knowledge/api_index_test.cj * test/tools/tools_test.cj * test/integration/server_test.cj * example/{minimal,full}/src/main.cj * benchmark/src/main.cj Verification ------------ This commit does NOT include a cjpm build pass because the authoring environment has no Cangjie 1.1.3 SDK installed. The rewrite was driven by: 1. The published 1.1.3 docs at docs.cangjie-lang.cn (main signature, std.process API, std.io file APIs, std.net HttpClient.get). 2. The cj-codelabs/docs sample projects (a-la cjpm / cjlint). 3. Manual code review of every file by the author. A maintainer with the SDK should run cjpm update && cjpm build and cjpm test to confirm. The most likely remaining issues are: * std.io.InputStream.stdin() / OutputStream.stdout() — the stdin/stdout static accessors exist on std.env in some versions; substitute if the compiler complains. * std.fs.Path(...) constructor — exists in 1.1.3 but the field shape differs from earlier versions. * ByteReader.read(buf: Array<UInt8>) — argument shape may need a slice or a different overload depending on the SDK. | 1 个月前 |