From eb0721ea26690671a29206ecd8702c03a8092e09 Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Thu, 6 Jul 2023 15:47:52 +0300 Subject: [PATCH 1/4] Remove pkg versions when using path dependency > A version specification should only be specified when no "path" attribute is present, or when compatibility with older versions of DUB (< 0.9.22) is desired. > - https://dub.pm/package-format-json.html#version-specs --- benchmarks/runtimemetrics/dub.json | 1 - examples/acceptnovisitors/dub.json | 1 - examples/adventure/dub.json | 1 - examples/matrix/dub.json | 1 - examples/next/dub.json | 1 - examples/rolex/dub.json | 1 - examples/synopsis/dub.json | 1 - examples/whytheunderscore/dub.json | 1 - tests/dub.json | 4 +++- 9 files changed, 3 insertions(+), 9 deletions(-) diff --git a/benchmarks/runtimemetrics/dub.json b/benchmarks/runtimemetrics/dub.json index d680229..e4b5979 100644 --- a/benchmarks/runtimemetrics/dub.json +++ b/benchmarks/runtimemetrics/dub.json @@ -35,7 +35,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "test against large code base", diff --git a/examples/acceptnovisitors/dub.json b/examples/acceptnovisitors/dub.json index a27a370..e0dbd28 100644 --- a/examples/acceptnovisitors/dub.json +++ b/examples/acceptnovisitors/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "replace awful visitor with neat open method", diff --git a/examples/adventure/dub.json b/examples/adventure/dub.json index 82ab886..765867e 100644 --- a/examples/adventure/dub.json +++ b/examples/adventure/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "example of a method with three virtual arguments", diff --git a/examples/matrix/dub.json b/examples/matrix/dub.json index a39ff10..37d6df5 100644 --- a/examples/matrix/dub.json +++ b/examples/matrix/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "unary and binary matrix operations with two types of matrices", diff --git a/examples/next/dub.json b/examples/next/dub.json index ddf30a7..cda55a2 100644 --- a/examples/next/dub.json +++ b/examples/next/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "example of 'next', equivalent to calling super", diff --git a/examples/rolex/dub.json b/examples/rolex/dub.json index 91459db..e06e6b2 100644 --- a/examples/rolex/dub.json +++ b/examples/rolex/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "Role and Expense example from the yomm11 article on Code Project", diff --git a/examples/synopsis/dub.json b/examples/synopsis/dub.json index dce40bd..d248fd3 100644 --- a/examples/synopsis/dub.json +++ b/examples/synopsis/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "synopsis", diff --git a/examples/whytheunderscore/dub.json b/examples/whytheunderscore/dub.json index d04a7a9..c8d0e90 100644 --- a/examples/whytheunderscore/dub.json +++ b/examples/whytheunderscore/dub.json @@ -36,7 +36,6 @@ "dependencies": { "openmethods": { "path": "../../", - "version": ">=0.0.0" } }, "description": "the reason for the underscore in front of method specializations", diff --git a/tests/dub.json b/tests/dub.json index 52fd8e9..3cc2ea3 100644 --- a/tests/dub.json +++ b/tests/dub.json @@ -10,7 +10,9 @@ "dflags": ["-mixin=mixins.txt"], "importPaths": ["../source", "source"], "dependencies": { - "openmethods": "*" + "openmethods": { + "path": "../", + } }, "buildTypes": { "x": { From 9e65f5298a8c0ec369afd6122404aeb89e41dd5c Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Thu, 6 Jul 2023 16:07:14 +0300 Subject: [PATCH 2/4] Add `.editorconfig` and normalize files --- .editorconfig | 29 +++++ .../dlang-meetup-2017-09-28/index.html | 110 +++++++++--------- tests/dub.json | 38 +++--- 3 files changed, 103 insertions(+), 74 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f9b69e7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.gitignore] +end_of_line = unset + +[*.{bat,cmd,ps1}] +end_of_line = crlf + +[*.{html,htm,xhtml,xml}] +indent_size = 2 + +[*.{css,scss,sass}] +indent_size = 2 + +[*.{json}] +indent_style = tab + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/presentations/dlang-meetup-2017-09-28/index.html b/presentations/dlang-meetup-2017-09-28/index.html index 2ff177b..573ad76 100644 --- a/presentations/dlang-meetup-2017-09-28/index.html +++ b/presentations/dlang-meetup-2017-09-28/index.html @@ -1,76 +1,76 @@ - - + + - reveal.js + reveal.js - - + + - - + + - - + + -
-
+
+
- +
- +
- +
- +
- +
- +
@@ -144,34 +144,34 @@
- +
-
-
+
+
- - + + - + diff --git a/tests/dub.json b/tests/dub.json index 3cc2ea3..e448c7c 100644 --- a/tests/dub.json +++ b/tests/dub.json @@ -7,27 +7,27 @@ "license": "Boost Software License 1.0", "name": "tests", "targetType": "library", - "dflags": ["-mixin=mixins.txt"], - "importPaths": ["../source", "source"], - "dependencies": { + "dflags": ["-mixin=mixins.txt"], + "importPaths": ["../source", "source"], + "dependencies": { "openmethods": { "path": "../", } }, - "buildTypes": { - "x": { - "debugVersions": ["explain"], - "buildOptions": ["debugMode", "debugInfo", "unittests"], - }, - "xtc": { - "debugVersions": ["explain", "traceCalls"], - "buildOptions": ["debugMode", "debugInfo", "unittests"], - }, - }, - "configurations": [ - { - "name": "unittest", - "dflags": ["-mixin=mixins.txt"], - }, - ] + "buildTypes": { + "x": { + "debugVersions": ["explain"], + "buildOptions": ["debugMode", "debugInfo", "unittests"], + }, + "xtc": { + "debugVersions": ["explain", "traceCalls"], + "buildOptions": ["debugMode", "debugInfo", "unittests"], + }, + }, + "configurations": [ + { + "name": "unittest", + "dflags": ["-mixin=mixins.txt"], + }, + ] } From 0ba2bde1c4a845f137ebb6d2e3206102d37e48c4 Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Thu, 6 Jul 2023 16:10:20 +0300 Subject: [PATCH 3/4] Remove useless parameters Fixes "Error: typesafe variadic function parameter `` of type `string` cannot be marked `return`" --- source/openmethods.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/openmethods.d b/source/openmethods.d index 162a936..25f7903 100644 --- a/source/openmethods.d +++ b/source/openmethods.d @@ -651,7 +651,7 @@ struct Method(alias module_, string name, int index) // ========================================================================== // Exceptions - static ReturnType notImplementedError(QualParams...) + static ReturnType notImplementedError(/+ QualParams... +/) { import std.meta; errorHandler(new MethodError(MethodError.NotImplemented, &info)); @@ -660,7 +660,7 @@ struct Method(alias module_, string name, int index) } } - static ReturnType ambiguousCallError(QualParams...) + static ReturnType ambiguousCallError(/+ QualParams... +/) { errorHandler(new MethodError(MethodError.AmbiguousCall, &info)); static if (!is(ReturnType == void)) { From 83547f5d8e80fd9ef3dd481985e1213b1378455f Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Thu, 6 Jul 2023 16:11:23 +0300 Subject: [PATCH 4/4] Fix nested/qualified modules and add tests --- source/openmethods.d | 21 +++++++++++---------- tests/source/qualified.mod.d | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 tests/source/qualified.mod.d diff --git a/source/openmethods.d b/source/openmethods.d index 25f7903..6f5ac4a 100644 --- a/source/openmethods.d +++ b/source/openmethods.d @@ -461,9 +461,10 @@ auto removeStorageClasses(rf.Parameter[] parameters) return parameters.map!(p => p.withStorageClasses([])).array; } -struct Method(alias module_, string name, int index) +struct Method(string module_, string name, int index) { - alias Module = module_; + mixin("static import ", module_, ";"); + alias Module = mixin(module_); enum Name = name; enum Index = index; @@ -582,11 +583,11 @@ struct Method(alias module_, string name, int index) .mixture); enum aliases = q{ - alias %s = openmethods.Method!(%s, "%s", %d).dispatcher; - alias %s = openmethods.Method!(%s, "%s", %d).discriminator; + alias %s = openmethods.Method!("%s", "%s", %d).dispatcher; + alias %s = openmethods.Method!("%s", "%s", %d).discriminator; }.format( - Name, __traits(identifier, Module), Name, Index, - Name, __traits(identifier, Module), Name, Index); + Name, module_, Name, Index, + Name, module_, Name, Index); // ========================================================================== // Method Registration @@ -779,7 +780,7 @@ unittest static assert(!hasVirtualParameters!nonmeth); } -string registrationMixture(alias MODULE, alias moduleName)() +string registrationMixture(alias MODULE, string moduleName)() { import std.array; @@ -789,7 +790,7 @@ string registrationMixture(alias MODULE, alias moduleName)() static if (is(typeof(__traits(getOverloads, MODULE, m)))) { foreach (i, o; __traits(getOverloads, MODULE, m)) { static if (hasVirtualParameters!(o)) { - mixture ~= openmethods.Method!(MODULE, m, i).aliases; + mixture ~= openmethods.Method!(moduleName, m, i).aliases; } } } @@ -804,7 +805,7 @@ string registrationMixture(alias MODULE, alias moduleName)() return join(mixture, "\n"); } -mixin template registrar(alias MODULE, alias ModuleName) +mixin template registrar(alias MODULE, string ModuleName) { import openmethods; import std.traits; @@ -815,7 +816,7 @@ mixin template registrar(alias MODULE, alias ModuleName) static if (is(typeof(__traits(getOverloads, MODULE, m)))) { foreach (i, o; __traits(getOverloads, MODULE, m)) { static if (hasVirtualParameters!(o)) { - openmethods.Method!(MODULE, m, i).register; + openmethods.Method!(ModuleName, m, i).register; } } } diff --git a/tests/source/qualified.mod.d b/tests/source/qualified.mod.d new file mode 100644 index 0000000..1deccd1 --- /dev/null +++ b/tests/source/qualified.mod.d @@ -0,0 +1,14 @@ +module qualified.mod; + +import openmethods; +mixin(registerMethods); + +interface Node {} + +void walkNode(virtual!Node); + +@method +void _walkNode(Node node) +{ + // Dummy +}