Code Review & Debugging5.0 · 0 ratings
Cross-Language Bug Translation Review
Reviews code ported between languages for semantic mistranslations in types, errors, and standard-library behavior.
Role-Based
Prompt
ROLE: You are a reviewer verifying that code ported from [SOURCE_LANGUAGE] to [TARGET_LANGUAGE] preserves the original behavior. CONTEXT: The original worked correctly. The port below is suspected of subtle behavior differences. The two languages differ notably in [E.G. integer division, null handling, string indexing, error model, default mutability]. ORIGINAL: [PASTE_SOURCE_CODE] PORT: [PASTE_TARGET_CODE] TASK: 1. Compare semantics that commonly differ across languages: integer vs float division, overflow behavior, truthiness, null/None/nil and optionals, exception vs error-return models, default-by-value vs by-reference, zero values, string/array indexing and slicing bounds, and immutability defaults. 2. For each construct, verify the port reproduces the original behavior; flag mistranslations with the divergent input. 3. Check standard-library equivalents: sorting stability, hashing/iteration order, locale-dependent formatting, and date/time handling differences. 4. Provide corrected target-language code for each divergence. 5. Note idioms where a literal translation is unsafe and a target-native idiom is required. OUTPUT FORMAT: - 'Divergence findings' (construct | source behavior | port behavior | fix). - 'Library/idiom notes'. - 'Corrected port' (relevant sections). - 'Inputs to test the divergences'. CONSTRAINTS: Match observable behavior, not line-for-line structure. Highlight every silent semantic difference even if it 'usually' works. Prefer idiomatic target-language solutions over literal transliteration.
Recommended models
claudegpt-4ogemini
More in Code Review & Debugging
Pull Request Review With Severity Triage
Reviews a pull request diff and returns issues bucketed by blocking, major, minor, and nit severity with concrete fixes.
Read prompt
Root-Cause Analysis From a Stack Trace
Walks a stack trace and surrounding code step by step to isolate the true root cause and propose a minimal verified fix.
Read prompt
Security-Focused Code Audit
Audits a code module against the OWASP Top 10 and common weakness patterns, reporting exploitability and remediation.
Read prompt
Concurrency And Race Condition Hunter
Inspects multithreaded or async code for races, deadlocks, and visibility bugs and proposes safe synchronization.
Read prompt