Un atelier Ruby · Édition d'ApprentissageA Ruby Workshop · Learning Edition

Proc vs Lambda, ou la fonction et le fragment Proc vs Lambda, the function and the fragment

Capturer un bloc dans un objet donne un proc ou une lambda. Même classe Proc, même .call — et deux comportements opposés : la lambda exige la bonne arité et son return est local ; le proc s'arrange de tout et son return sort de la méthode englobante. Une fonction, ou un fragment ? Choisis. Capturing a block in an object gives a proc or a lambda. Same Proc class, same .call — and two opposite behaviors: the lambda demands the right arity and its return is local; the proc shrugs everything off and its return exits the enclosing method. A function, or a fragment? Choose.

AudienceAudience
Dev à l'aise avec les blocs, prêt à les capturer en objets Dev comfortable with blocks, ready to capture them as objects
Format
Self-paced
ChapitresChapters
5
Date
Jan 2026 Jan 2026
≈ 18 min ●●○○ BlocProcLambda
🔒

La suite est réservée The rest is members-only

Le premier numéro est libre. Débloque tout The Ruby Loop — tous les volumes, à vie — pour 5 €, paiement unique. The first issue is free. Unlock all of The Ruby Loop — every volume, forever — for €5, one-time.

Retour au kiosqueBack to newsstand