diff --git a/components/skills/meta-convert-guide/reference/difficulty-matrix.md b/components/skills/meta-convert-guide/reference/difficulty-matrix.md index 9c35d03..0d5cdfa 100644 --- a/components/skills/meta-convert-guide/reference/difficulty-matrix.md +++ b/components/skills/meta-convert-guide/reference/difficulty-matrix.md @@ -3,6 +3,7 @@ Single source of truth for language pair conversion difficulty ratings. > **Referenced by:** +> > - `create-lang-conversion-skill.md` (Step 3.5) > - `meta-convert-dev/SKILL.md` > - `meta-convert-guide/SKILL.md` @@ -13,46 +14,46 @@ Single source of truth for language pair conversion difficulty ratings. ### Factors (0-2 points each) -| Factor | Easy (+0) | Medium (+1) | Hard (+2) | -|--------|-----------|-------------|-----------| -| **Type System** | Both static or both dynamic | Mixed static/dynamic | Opposite philosophies (e.g., gradual→strict) | -| **Paradigm** | Same paradigm | Related paradigms | Opposite paradigms (OOP↔Pure FP) | -| **Memory Model** | Both GC or both manual | Different GC strategies | GC ↔ Ownership/Manual | -| **Concurrency** | Same model | Related models | Fundamentally different (Actors↔Threads) | -| **Platform** | Same runtime | Related runtimes | Different platforms (JVM↔Native) | +| Factor | Easy (+0) | Medium (+1) | Hard (+2) | +| ---------------- | --------------------------- | ----------------------- | -------------------------------------------- | +| **Type System** | Both static or both dynamic | Mixed static/dynamic | Opposite philosophies (e.g., gradual→strict) | +| **Paradigm** | Same paradigm | Related paradigms | Opposite paradigms (OOP↔Pure FP) | +| **Memory Model** | Both GC or both manual | Different GC strategies | GC ↔ Ownership/Manual | +| **Concurrency** | Same model | Related models | Fundamentally different (Actors↔Threads) | +| **Platform** | Same runtime | Related runtimes | Different platforms (JVM↔Native) | ### Difficulty Levels -| Total Score | Level | Expected Skill Size | Focus Areas | -|-------------|-------|---------------------|-------------| -| 0-2 | **Easy** | 200-400 lines | Idiom differences, library mapping | -| 3-5 | **Medium** | 400-800 lines | Type translation, paradigm shifts | -| 6-8 | **Hard** | 800-1200 lines | Memory model, concurrency, architecture | -| 9-10 | **Expert** | 1200+ lines | Complete paradigm shift, all factors differ | +| Total Score | Level | Expected Skill Size | Focus Areas | +| ----------- | ---------- | ------------------- | ------------------------------------------- | +| 0-2 | **Easy** | 200-400 lines | Idiom differences, library mapping | +| 3-5 | **Medium** | 400-800 lines | Type translation, paradigm shifts | +| 6-8 | **Hard** | 800-1200 lines | Memory model, concurrency, architecture | +| 9-10 | **Expert** | 1200+ lines | Complete paradigm shift, all factors differ | --- ## Language Characteristics -| Language | Type | Paradigm | Memory | Concurrency | Platform | -|----------|------|----------|--------|-------------|----------| -| C | Static | Imperative | Manual | Threads | Native | -| C++ | Static | Multi (OOP) | Manual/RAII | Threads | Native | -| Clojure | Dynamic | Functional | GC | STM/Agents | JVM | -| Elixir | Dynamic | Functional | GC | Actors | BEAM | -| Elm | Static | Pure FP | GC | TEA/Messages | JS | -| Erlang | Dynamic | Functional | GC | Actors | BEAM | -| F# | Static | Functional | GC | Async | .NET | -| Go | Static | Imperative | GC | CSP | Native | -| Haskell | Static | Pure FP | GC | STM/Async | Native | -| Java | Static | OOP | GC | Threads | JVM | -| Obj-C | Static | OOP | ARC | GCD | Apple | -| Python | Dynamic | Multi | GC | Async/Threads | Interpreted | -| Roc | Static | Pure FP | GC | Effects | Native | -| Rust | Static | Multi | Ownership | Async/Threads | Native | -| Scala | Static | Multi (FP/OOP) | GC | Actors/Async | JVM | -| Swift | Static | Multi | ARC | GCD/Async | Apple | -| TypeScript | Static | Multi | GC | Promises | JS | +| Language | Type | Paradigm | Memory | Concurrency | Platform | +| ---------- | ------- | -------------- | ----------- | ------------- | ----------- | +| C | Static | Imperative | Manual | Threads | Native | +| C++ | Static | Multi (OOP) | Manual/RAII | Threads | Native | +| Clojure | Dynamic | Functional | GC | STM/Agents | JVM | +| Elixir | Dynamic | Functional | GC | Actors | BEAM | +| Elm | Static | Pure FP | GC | TEA/Messages | JS | +| Erlang | Dynamic | Functional | GC | Actors | BEAM | +| F# | Static | Functional | GC | Async | .NET | +| Go | Static | Imperative | GC | CSP | Native | +| Haskell | Static | Pure FP | GC | STM/Async | Native | +| Java | Static | OOP | GC | Threads | JVM | +| Obj-C | Static | OOP | ARC | GCD | Apple | +| Python | Dynamic | Multi | GC | Async/Threads | Interpreted | +| Roc | Static | Pure FP | GC | Effects | Native | +| Rust | Static | Multi | Ownership | Async/Threads | Native | +| Scala | Static | Multi (FP/OOP) | GC | Actors/Async | JVM | +| Swift | Static | Multi | ARC | GCD/Async | Apple | +| TypeScript | Static | Multi | GC | Promises | JS | --- @@ -62,106 +63,106 @@ Single source of truth for language pair conversion difficulty ratings. Languages: Clojure, Elixir, Elm, Erlang, F#, Haskell, Roc, Scala -| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | -|------|------|----------|--------|-------------|----------|-----------|-----------| -| clojure-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| clojure-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| clojure-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| clojure-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| clojure-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| clojure-roc | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| clojure-scala | +0 | +0 | +0 | +1 | +0 | **1** | Easy | -| elixir-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| elixir-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| elixir-erlang | +0 | +0 | +0 | +0 | +0 | **0** | Easy | -| elixir-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| elixir-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| elixir-roc | +1 | +1 | +0 | +2 | +2 | **6** | Hard | -| elixir-scala | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| elm-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| elm-elixir | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| elm-erlang | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| elm-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| elm-haskell | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| elm-roc | +0 | +0 | +0 | +0 | +2 | **2** | Easy | -| elm-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| erlang-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| erlang-elixir | +0 | +0 | +0 | +0 | +0 | **0** | Easy | -| erlang-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| erlang-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| erlang-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| erlang-roc | +1 | +1 | +0 | +2 | +2 | **6** | Hard | -| erlang-scala | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| fsharp-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| fsharp-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| fsharp-elm | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| fsharp-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| fsharp-haskell | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| fsharp-roc | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| fsharp-scala | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| haskell-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| haskell-elixir | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| haskell-elm | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| haskell-erlang | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| haskell-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| haskell-roc | +0 | +0 | +0 | +1 | +0 | **1** | Easy | -| haskell-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| roc-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| roc-elixir | +1 | +1 | +0 | +2 | +2 | **6** | Hard | -| roc-elm | +0 | +0 | +0 | +0 | +2 | **2** | Easy | -| roc-erlang | +1 | +1 | +0 | +2 | +2 | **6** | Hard | -| roc-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| roc-haskell | +0 | +0 | +0 | +1 | +0 | **1** | Easy | -| roc-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| scala-clojure | +0 | +0 | +0 | +1 | +0 | **1** | Easy | -| scala-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| scala-elm | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| scala-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| scala-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | -| scala-haskell | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| scala-roc | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | +| --------------- | ---- | -------- | ------ | ----------- | -------- | --------- | --------- | +| clojure-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| clojure-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| clojure-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| clojure-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| clojure-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| clojure-roc | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| clojure-scala | +0 | +0 | +0 | +1 | +0 | **1** | Easy | +| elixir-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| elixir-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| elixir-erlang | +0 | +0 | +0 | +0 | +0 | **0** | Easy | +| elixir-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| elixir-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| elixir-roc | +1 | +1 | +0 | +2 | +2 | **6** | Hard | +| elixir-scala | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| elm-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| elm-elixir | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| elm-erlang | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| elm-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| elm-haskell | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| elm-roc | +0 | +0 | +0 | +0 | +2 | **2** | Easy | +| elm-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| erlang-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| erlang-elixir | +0 | +0 | +0 | +0 | +0 | **0** | Easy | +| erlang-elm | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| erlang-fsharp | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| erlang-haskell | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| erlang-roc | +1 | +1 | +0 | +2 | +2 | **6** | Hard | +| erlang-scala | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| fsharp-clojure | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| fsharp-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| fsharp-elm | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| fsharp-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| fsharp-haskell | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| fsharp-roc | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| fsharp-scala | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| haskell-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| haskell-elixir | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| haskell-elm | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| haskell-erlang | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| haskell-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| haskell-roc | +0 | +0 | +0 | +1 | +0 | **1** | Easy | +| haskell-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| roc-clojure | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| roc-elixir | +1 | +1 | +0 | +2 | +2 | **6** | Hard | +| roc-elm | +0 | +0 | +0 | +0 | +2 | **2** | Easy | +| roc-erlang | +1 | +1 | +0 | +2 | +2 | **6** | Hard | +| roc-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| roc-haskell | +0 | +0 | +0 | +1 | +0 | **1** | Easy | +| roc-scala | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| scala-clojure | +0 | +0 | +0 | +1 | +0 | **1** | Easy | +| scala-elixir | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| scala-elm | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| scala-erlang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| scala-fsharp | +0 | +0 | +0 | +1 | +2 | **3** | Medium | +| scala-haskell | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| scala-roc | +0 | +1 | +0 | +1 | +2 | **4** | Medium | ### Python Conversions -| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | -|------|------|----------|--------|-------------|----------|-----------|-----------| -| python-clojure | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| python-elixir | +0 | +1 | +0 | +2 | +2 | **5** | Medium | -| python-elm | +1 | +2 | +0 | +1 | +2 | **6** | Hard | -| python-erlang | +0 | +1 | +0 | +2 | +2 | **5** | Medium | -| python-fsharp | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| python-golang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | -| python-haskell | +1 | +2 | +0 | +1 | +2 | **6** | Hard | -| python-roc | +1 | +2 | +0 | +1 | +2 | **6** | Hard | -| python-rust | +1 | +1 | +2 | +1 | +2 | **7** | Hard | -| python-scala | +1 | +1 | +0 | +1 | +2 | **5** | Medium | -| python-typescript | +0 | +0 | +0 | +0 | +1 | **1** | Easy | +| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | +| ----------------- | ---- | -------- | ------ | ----------- | -------- | --------- | --------- | +| python-clojure | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| python-elixir | +0 | +1 | +0 | +2 | +2 | **5** | Medium | +| python-elm | +1 | +2 | +0 | +1 | +2 | **6** | Hard | +| python-erlang | +0 | +1 | +0 | +2 | +2 | **5** | Medium | +| python-fsharp | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| python-golang | +1 | +0 | +0 | +1 | +2 | **4** | Medium | +| python-haskell | +1 | +2 | +0 | +1 | +2 | **6** | Hard | +| python-roc | +1 | +2 | +0 | +1 | +2 | **6** | Hard | +| python-rust | +1 | +1 | +2 | +1 | +2 | **7** | Hard | +| python-scala | +1 | +1 | +0 | +1 | +2 | **5** | Medium | +| python-typescript | +0 | +0 | +0 | +0 | +1 | **1** | Easy | ### TypeScript Conversions -| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | -|------|------|----------|--------|-------------|----------|-----------|-----------| -| typescript-golang | +0 | +1 | +0 | +1 | +2 | **4** | Medium | -| typescript-python | +0 | +0 | +0 | +0 | +1 | **1** | Easy | -| typescript-rust | +0 | +1 | +2 | +1 | +2 | **6** | Hard | +| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | +| ----------------- | ---- | -------- | ------ | ----------- | -------- | --------- | --------- | +| typescript-golang | +0 | +1 | +0 | +1 | +2 | **4** | Medium | +| typescript-python | +0 | +0 | +0 | +0 | +1 | **1** | Easy | +| typescript-rust | +0 | +1 | +2 | +1 | +2 | **6** | Hard | ### Systems Language Conversions -| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | -|------|------|----------|--------|-------------|----------|-----------|-----------| -| c-cpp | +0 | +0 | +0 | +0 | +0 | **0** | Easy | -| c-rust | +0 | +1 | +1 | +1 | +0 | **3** | Medium | -| cpp-rust | +0 | +0 | +1 | +0 | +0 | **1** | Easy | -| golang-rust | +0 | +0 | +2 | +1 | +0 | **3** | Medium | -| java-c | +0 | +1 | +2 | +1 | +2 | **6** | Hard | -| java-cpp | +0 | +0 | +2 | +0 | +2 | **4** | Medium | -| java-rust | +0 | +1 | +2 | +1 | +2 | **6** | Hard | +| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | +| ----------- | ---- | -------- | ------ | ----------- | -------- | --------- | --------- | +| c-cpp | +0 | +0 | +0 | +0 | +0 | **0** | Easy | +| c-rust | +0 | +1 | +1 | +1 | +0 | **3** | Medium | +| cpp-rust | +0 | +0 | +1 | +0 | +0 | **1** | Easy | +| golang-rust | +0 | +0 | +2 | +1 | +0 | **3** | Medium | +| java-c | +0 | +1 | +2 | +1 | +2 | **6** | Hard | +| java-cpp | +0 | +0 | +2 | +0 | +2 | **4** | Medium | +| java-rust | +0 | +1 | +2 | +1 | +2 | **6** | Hard | ### Platform-Specific -| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | -|------|------|----------|--------|-------------|----------|-----------|-----------| -| objc-swift | +0 | +0 | +0 | +0 | +0 | **0** | Easy | +| Pair | Type | Paradigm | Memory | Concurrency | Platform | **Total** | **Level** | +| ---------- | ---- | -------- | ------ | ----------- | -------- | --------- | --------- | +| objc-swift | +0 | +0 | +0 | +0 | +0 | **0** | Easy | --- @@ -169,48 +170,50 @@ Languages: Clojure, Elixir, Elm, Erlang, F#, Haskell, Roc, Scala ### Easy (0-2 points) - 10 pairs -| Pair | Score | Notes | -|------|-------|-------| -| c-cpp | 0 | Same family | -| elixir-erlang | 0 | Same platform (BEAM) | -| erlang-elixir | 0 | Same platform (BEAM) | -| objc-swift | 0 | Same platform (Apple) | -| clojure-scala | 1 | Same platform (JVM) | -| cpp-rust | 1 | Similar memory models | -| haskell-roc | 1 | Similar pure FP | -| python-typescript | 1 | Similar multi-paradigm | -| roc-haskell | 1 | Similar pure FP | -| scala-clojure | 1 | Same platform (JVM) | -| typescript-python | 1 | Similar multi-paradigm | -| elm-roc | 2 | Both pure FP | -| roc-elm | 2 | Both pure FP | +| Pair | Score | Notes | +| ----------------- | ----- | ---------------------- | +| c-cpp | 0 | Same family | +| elixir-erlang | 0 | Same platform (BEAM) | +| erlang-elixir | 0 | Same platform (BEAM) | +| objc-swift | 0 | Same platform (Apple) | +| clojure-scala | 1 | Same platform (JVM) | +| cpp-rust | 1 | Similar memory models | +| haskell-roc | 1 | Similar pure FP | +| python-typescript | 1 | Similar multi-paradigm | +| roc-haskell | 1 | Similar pure FP | +| scala-clojure | 1 | Same platform (JVM) | +| typescript-python | 1 | Similar multi-paradigm | +| elm-roc | 2 | Both pure FP | +| roc-elm | 2 | Both pure FP | ### Medium (3-5 points) - 47 pairs Most functional↔functional conversions fall here. Key challenges: + - Platform differences (JVM↔BEAM↔.NET↔Native) - Concurrency model translation (Actors↔STM↔Async) - Type system differences (static↔dynamic) ### Hard (6-8 points) - 18 pairs -| Pair | Score | Key Challenges | -|------|-------|----------------| -| python-rust | 7 | GC→Ownership, dynamic→static | -| python-elm | 6 | Multi→Pure FP, architecture shift | -| python-haskell | 6 | Multi→Pure FP, type system | -| python-roc | 6 | Multi→Pure FP, platform | -| typescript-rust | 6 | GC→Ownership, platform | -| java-c | 6 | GC→Manual, platform | -| java-rust | 6 | GC→Ownership, platform | -| elixir-roc | 6 | Actors→Effects, BEAM→Native | -| erlang-roc | 6 | Actors→Effects, BEAM→Native | -| roc-elixir | 6 | Effects→Actors, Native→BEAM | -| roc-erlang | 6 | Effects→Actors, Native→BEAM | +| Pair | Score | Key Challenges | +| --------------- | ----- | --------------------------------- | +| python-rust | 7 | GC→Ownership, dynamic→static | +| python-elm | 6 | Multi→Pure FP, architecture shift | +| python-haskell | 6 | Multi→Pure FP, type system | +| python-roc | 6 | Multi→Pure FP, platform | +| typescript-rust | 6 | GC→Ownership, platform | +| java-c | 6 | GC→Manual, platform | +| java-rust | 6 | GC→Ownership, platform | +| elixir-roc | 6 | Actors→Effects, BEAM→Native | +| erlang-roc | 6 | Actors→Effects, BEAM→Native | +| roc-elixir | 6 | Effects→Actors, Native→BEAM | +| roc-erlang | 6 | Effects→Actors, Native→BEAM | ### Expert (9-10 points) - 0 pairs No current pairs reach expert level. Would require: + - Dynamic OOP → Static Pure FP with ownership - Example: Python → a hypothetical pure FP + ownership language @@ -237,6 +240,7 @@ See [difficulty-matrix.md](../../meta-convert-guide/reference/difficulty-matrix. ### Updating This Matrix When adding a new conversion skill: + 1. Calculate score using the Rating Framework above 2. Add entry to the appropriate section 3. Update summary tables if needed diff --git a/components/skills/meta-convert-guide/reference/memory-ownership.md b/components/skills/meta-convert-guide/reference/memory-ownership.md index d8ecc40..58f92ee 100644 --- a/components/skills/meta-convert-guide/reference/memory-ownership.md +++ b/components/skills/meta-convert-guide/reference/memory-ownership.md @@ -7,7 +7,7 @@ Comprehensive reference for memory model translation, especially GC → Ownershi ## Memory Model Comparison | Language | Memory Model | Cleanup | Ownership | -|------------|---------------------------|----------------------|--------------------| +| ---------- | ------------------------- | -------------------- | ------------------ | | TypeScript | GC (V8) | Automatic | Shared references | | Python | GC (ref counting + cycle) | Automatic | Shared references | | Go | GC (concurrent) | Automatic | Shared references | @@ -21,13 +21,13 @@ Comprehensive reference for memory model translation, especially GC → Ownershi ### Key Differences -| GC Languages | Ownership Languages | -|--------------|---------------------| -| Allocate freely | Consider ownership at creation | -| Share references anywhere | One owner, many borrows | -| Cleanup "sometime later" | Cleanup when owner goes out of scope | -| Circular refs OK (with cycle detection) | Circular refs need Rc/Arc | -| Simple mental model | More planning required | +| GC Languages | Ownership Languages | +| --------------------------------------- | ------------------------------------ | +| Allocate freely | Consider ownership at creation | +| Share references anywhere | One owner, many borrows | +| Cleanup "sometime later" | Cleanup when owner goes out of scope | +| Circular refs OK (with cycle detection) | Circular refs need Rc/Arc | +| Simple mental model | More planning required | ### Ownership Decision Tree @@ -58,7 +58,7 @@ START: Is this data shared across components? ## Borrowing Pattern Reference | Source Pattern | Rust Pattern | When to Use | -|---------------------|---------------------------|---------------------------------------------------| +| ------------------- | ------------------------- | ------------------------------------------------- | | Pass by reference | `&T` | Read-only access, no mutation needed | | Mutable reference | `&mut T` | Single mutator, temporary access | | Shared ownership | `Rc` / `Arc` | Multiple owners, single-threaded / multi-threaded | @@ -135,13 +135,13 @@ START: Is the data expensive to clone? ### When to Clone -| Situation | Clone? | Alternative | -|-----------|--------|-------------| -| Storing in collection | Often yes | Arc for large data | -| Passing to thread | Yes (or Arc) | - | -| Returning to caller | Usually yes | Return reference with lifetime | -| Internal computation | Usually no | Borrow | -| Small Copy types | Implicit | - | +| Situation | Clone? | Alternative | +| --------------------- | ------------ | ------------------------------ | +| Storing in collection | Often yes | Arc for large data | +| Passing to thread | Yes (or Arc) | - | +| Returning to caller | Usually yes | Return reference with lifetime | +| Internal computation | Usually no | Borrow | +| Small Copy types | Implicit | - | --- @@ -155,11 +155,11 @@ class Cache { private data: Map = new Map(); get(id: string): User | undefined { - return this.data.get(id); // Returns reference + return this.data.get(id); // Returns reference } set(id: string, user: User): void { - this.data.set(id, user); // Stores reference + this.data.set(id, user); // Stores reference } } ``` @@ -193,14 +193,14 @@ impl Cache { ## Smart Pointers -| Pointer | Thread-Safe | Use Case | -|---------|-------------|----------| -| `Box` | N/A (single owner) | Heap allocation, recursive types | -| `Rc` | No | Multiple owners, single thread | -| `Arc` | Yes | Multiple owners, multi-thread | -| `RefCell` | No | Interior mutability, single thread | -| `Mutex` | Yes | Interior mutability, multi-thread | -| `RwLock` | Yes | Read-heavy interior mutability | +| Pointer | Thread-Safe | Use Case | +| ------------ | ------------------ | ---------------------------------- | +| `Box` | N/A (single owner) | Heap allocation, recursive types | +| `Rc` | No | Multiple owners, single thread | +| `Arc` | Yes | Multiple owners, multi-thread | +| `RefCell` | No | Interior mutability, single thread | +| `Mutex` | Yes | Interior mutability, multi-thread | +| `RwLock` | Yes | Read-heavy interior mutability | ### Common Combinations @@ -230,7 +230,7 @@ async function withFile(path: string, fn: (file: File) => void) { try { await fn(file); } finally { - await file.close(); // Must remember to close + await file.close(); // Must remember to close } } ``` @@ -307,11 +307,11 @@ let data = Arc::new(config); ## Performance Implications -| Pattern | Cost | When to Use | -|---------|------|-------------| -| Move | Free | Default for owned values | -| Borrow (&T) | Free | Read access | -| Mutable borrow (&mut T) | Free | Exclusive write access | -| Clone | O(n) | When you need independent copy | -| Rc/Arc clone | O(1) | Shared ownership | -| Mutex lock | Synchronization cost | Shared mutable access | +| Pattern | Cost | When to Use | +| ----------------------- | -------------------- | ------------------------------ | +| Move | Free | Default for owned values | +| Borrow (&T) | Free | Read access | +| Mutable borrow (&mut T) | Free | Exclusive write access | +| Clone | O(n) | When you need independent copy | +| Rc/Arc clone | O(1) | Shared ownership | +| Mutex lock | Synchronization cost | Shared mutable access | diff --git a/components/skills/meta-convert-guide/reference/metaprogramming.md b/components/skills/meta-convert-guide/reference/metaprogramming.md index d06e901..1d04016 100644 --- a/components/skills/meta-convert-guide/reference/metaprogramming.md +++ b/components/skills/meta-convert-guide/reference/metaprogramming.md @@ -7,7 +7,7 @@ Comprehensive reference for metaprogramming capabilities across languages. ## Capability Comparison | Language | Decorators | Macros | Reflection | Code Gen | -|------------|-----------------------------|------------------------------|-----------------------|-----------------------| +| ---------- | --------------------------- | ---------------------------- | --------------------- | --------------------- | | Python | `@decorator` | No | `inspect`, `__dict__` | `ast` | | TypeScript | `@decorator` (experimental) | No | Limited runtime | Via build | | Rust | `#[attr]` | `macro_rules!`, proc macros | No | Proc macros | @@ -24,12 +24,12 @@ Comprehensive reference for metaprogramming capabilities across languages. ### Basic Translation -| Python/TS Pattern | Rust Pattern | Go Pattern | -|-------------------|--------------|------------| -| `@decorator` | `#[attribute]` | Struct tags + codegen | -| `@decorator(args)` | `#[attribute(args)]` | Struct tags | -| Class decorator | Derive macro | Type definition | -| Method decorator | Proc macro | Manual wrapper | +| Python/TS Pattern | Rust Pattern | Go Pattern | +| ------------------ | -------------------- | --------------------- | +| `@decorator` | `#[attribute]` | Struct tags + codegen | +| `@decorator(args)` | `#[attribute(args)]` | Struct tags | +| Class decorator | Derive macro | Type definition | +| Method decorator | Proc macro | Manual wrapper | ### Route Decorator Example @@ -91,14 +91,14 @@ r.GET("/users/:id", authMiddleware(), ctrl.GetUser) ### Macro Type Comparison -| Type | Language | Capabilities | -|------|----------|--------------| -| Text substitution | C | Simple replacement | -| Declarative | Rust `macro_rules!` | Pattern matching | -| Procedural | Rust proc macros | AST manipulation | -| Hygienic | Elixir, Rust | No accidental capture | -| Reader | Clojure | Syntax extension | -| Template | Haskell TH | Compile-time codegen | +| Type | Language | Capabilities | +| ----------------- | ------------------- | --------------------- | +| Text substitution | C | Simple replacement | +| Declarative | Rust `macro_rules!` | Pattern matching | +| Procedural | Rust proc macros | AST manipulation | +| Hygienic | Elixir, Rust | No accidental capture | +| Reader | Clojure | Syntax extension | +| Template | Haskell TH | Compile-time codegen | ### Declarative Macro Example @@ -132,7 +132,7 @@ end ## Reflection Capabilities | Capability | Python | TypeScript | Rust | Go | -|------------------|---------------------------|---------------------|--------------|---------------------------| +| ---------------- | ------------------------- | ------------------- | ------------ | ------------------------- | | Get field names | `dir()`, `__dict__` | `Object.keys()` | Derive macro | `reflect.TypeOf()` | | Get field values | `getattr()` | Direct access | No | `reflect.ValueOf()` | | Set field values | `setattr()` | Direct access | No | `reflect.Set()` (limited) | @@ -141,20 +141,20 @@ end ### Translation Strategies -| Reflection Use Case | Static Language Alternative | -|---------------------|----------------------------| -| Serialization | Derive macros, codegen | -| Dependency injection | Constructor injection | -| ORM mapping | Compile-time macros | -| Dynamic dispatch | Trait objects, enums | -| Configuration | Builder pattern | +| Reflection Use Case | Static Language Alternative | +| -------------------- | --------------------------- | +| Serialization | Derive macros, codegen | +| Dependency injection | Constructor injection | +| ORM mapping | Compile-time macros | +| Dynamic dispatch | Trait objects, enums | +| Configuration | Builder pattern | --- ## Dependency Injection Patterns | Language | DI Approach | Example | -|-------------|-------------------------------|---------------------------------------| +| ----------- | ----------------------------- | ------------------------------------- | | TypeScript | Class decorators + reflection | `@Injectable()`, Angular/NestJS | | Python | Decorators + containers | `@inject`, dependency-injector | | Rust | Trait objects + constructors | Manual DI, no runtime reflection | @@ -202,12 +202,12 @@ fn create_services() -> UserService { ### Build-Time vs Runtime -| Approach | Languages | When | -|----------|-----------|------| -| Compile-time macros | Rust, Elixir, Clojure | Compilation | -| Annotation processors | Java, Kotlin | Compilation | -| go generate | Go | Before compilation | -| Runtime reflection | Python, JS, Java | Runtime | +| Approach | Languages | When | +| --------------------- | --------------------- | ------------------ | +| Compile-time macros | Rust, Elixir, Clojure | Compilation | +| Annotation processors | Java, Kotlin | Compilation | +| go generate | Go | Before compilation | +| Runtime reflection | Python, JS, Java | Runtime | ### Go Generate Pattern @@ -238,14 +238,14 @@ struct User { ## Mixin / Trait Composition -| Language | Pattern | Example | -|----------|---------|---------| -| Python | Multiple inheritance | `class C(A, B)` | -| Ruby | Module include | `include ModuleName` | -| TypeScript | Mixin function | `class extends Mixin(Base)` | -| Rust | Multiple impl | `impl TraitA for T`, `impl TraitB for T` | -| Go | Embedding | `type C struct { A; B }` | -| Scala | Trait mixing | `class C extends A with B` | +| Language | Pattern | Example | +| ---------- | -------------------- | ---------------------------------------- | +| Python | Multiple inheritance | `class C(A, B)` | +| Ruby | Module include | `include ModuleName` | +| TypeScript | Mixin function | `class extends Mixin(Base)` | +| Rust | Multiple impl | `impl TraitA for T`, `impl TraitB for T` | +| Go | Embedding | `type C struct { A; B }` | +| Scala | Trait mixing | `class C extends A with B` | ### Translation Example