Compiler
41 bites tagged Compiler — interview questions with model answers, and 60-second explainers.
What is Angular Ivy's 'locality' and its benefits over View Engine?
Tests Ivy's per-file compilation model. Locality compiles decorators to static properties without global knowledge, except components need their NgModule scope, speeding builds and tree-shaking.
How does ngc work in Angular AOT and what artifacts improve performance?
This tests understanding of AOT build-phase compilation and output. Cover efficient JS output, inlined templates and styles cutting AJAX requests, and removal of compiler payload roughly half of Angular. Red flag: conflating AOT and JIT or calling it bundling.
Explain patch flags and static hoisting in Vue 3's compiler
Tests your grasp of compiler-informed virtual DOM optimizations. A strong answer covers patch flags as bitmap hints for dynamic bindings and static hoisting as extracting static nodes to skip diffing. Red flag: claiming Vue 3 removes the virtual DOM.
How does Svelte compile count += 1 into DOM updates?
Tests if you know Svelte reactivity is compile-time via runes, not runtime proxies. Good answer: $state marks reactive vars; runes are compiler hooks; compiler emits DOM-sync code. Red flag: describing useState or VDOM.
How is a Vue template compiled into a render function?
Map v-if to ternaries, v-for to array map, and events to onXxx props. Knowing Vue templates compile to h() render functions and directives become JS control flow. Believing directives survive as runtime HTML attributes.
Why is Svelte called a 'disappearing framework'?
Tests whether you understand compile-time versus runtime-heavy frameworks. A strong answer says Svelte compiles components to vanilla JS at build time, shipping a tiny runtime instead of a reconciler or virtual DOM. Red flag: claiming there is zero runtime.
How does Svelte surgically update the DOM without VDOM?
Tests VDOM overhead vs compile-time optimization. A strong answer explains that Svelte compiles reactive dependencies into direct DOM API calls, skipping tree creation and diffing. Red flag: claiming VDOM is slow because the DOM itself is slow.
Svelte compiler downsides vs Vue and Angular runtime
Tests compile-time versus runtime trade-offs in large apps. Strong answers address dynamic component limits, plugin friction, build scalability, and migration cost. Red flag: claiming Svelte has no runtime or that dynamic components are impossible.
How does Svelte update the DOM without a Virtual DOM?
This tests compile-time versus runtime framework architecture. A strong answer says Svelte compiles components into imperative JS that surgically updates the DOM when reactive state changes. A red flag is claiming it uses a hidden VDOM or dirty checking.
Compare and contrast Vue 3 and Svelte reactivity systems
Tests runtime versus compile-time trade-offs. Contrast Vue 3 Proxy interception with Svelte compile-time assignment transforms. Vue tracks dependencies dynamically during effects; Svelte resolves them at build. Red flag: claiming both use runtime Proxies.
What is the primary end-user benefit of Svelte's compiler-first approach?
Tests if you connect compiler architecture to user-facing performance. Strong answer: build-time work shrinks bundles and reduces browser overhead for faster loads on slow devices. Red flag: answering with developer ergonomics instead of runtime performance.
Svelte Logic Blocks: Template Control Flow
Svelte logic blocks are compiler directives disguised as HTML comments that branch, loop, and await inside templates. You write {#if}, {#each}, and {#await} directly in markup.
Result Builders: Declarative Swift DSLs
Result builders teach the compiler to fold expressions into one combined value, enabling declarative DSLs. SwiftUI relies on them to compose stacked views. Type errors surface on compiler-generated boilerplate instead of your original code.
Swift Enums: Type-Safe Choice Modeling
A Swift enum is a closed menu of possibilities the compiler tracks exhaustively. Use it to replace string constants or model a network result state. Adding a case without updating every switch breaks compile-time safety if you rely on a default clause.
Go Escape Analysis Chooses Stack Over Heap
Go escape analysis is the compiler pass that decides whether a variable lives on the stack or heap. It avoids heap allocations when data stays local, but any pointer that outlives its function escapes. The footgun is assuming small values never allocate.
Tree Shaking Removes Unused Flutter Code
Tree shaking is the compiler deleting code your app never calls, so importing a massive package only costs the pieces you use. It runs automatically in release builds. Relying on dynamic dispatch or dart:mirrors silently disables it and brings back the bloat.
What is a suspend function in Kotlin and its compiler rules?
This tests your understanding of suspendable computations and compiler transformation. A strong answer notes non-blocking suspension, the call-from-suspend-context rule, and compiler support for pausing and resuming. A red flag is claiming they block threads.
What are the primary advantages of using a data class?
Tests Kotlin boilerplate reduction and value semantics. Name three generated functions like equals, hashCode, and copy; explain structural equality; and show copy updating immutable UI state.
What is a reified type parameter in Kotlin?
Tests your grasp of JVM type erasure and Kotlin's solution. Explain that `reified` makes a generic type accessible at runtime inside an `inline` function, avoiding manual `Class` passing. A red flag is failing to link `reified` directly to `inline` functions.
Explain `inline` and `reified` in Kotlin
Tests your grasp of JVM performance costs and type erasure. A great answer explains how `inline` avoids object allocation for lambdas, and how this enables `reified` to bypass type erasure for runtime checks. A red flag is just saying 'it's for performance'.
What problem does `inline` solve, and how does `reified` relate?
This tests your grasp of Kotlin compiler optimizations and JVM type erasure. Explain that `inline` eliminates the runtime overhead of lambda objects. Then, describe how `reified` leverages inlining to make generic types accessible at runtime.
Svelte's Reactivity: A Compiler, Not a Library
Svelte achieves reactivity at compile time, not runtime. It's a compiler that turns your component files into efficient, imperative JavaScript that updates the DOM directly, skipping the virtual DOM. The footgun: reactivity only triggers on assignment.
Vue's <script setup>: Less Boilerplate, More Performance
Vue's <script setup> is compile-time sugar that automatically exposes variables and functions to your template, cutting boilerplate. It yields more succinct, performant components with better type-safety.
Configuring the Angular Compiler (ngc)
The Angular Compiler (ngc) transforms your templates into optimized JavaScript ahead-of-time. You tune it in `tsconfig.json` to create smaller production builds or publish reusable libraries.
Get Compiler bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.