@@ -87,7 +87,7 @@ literals = mkPattern' match'
8787 , prettyPrintCpp' target
8888 , return $ emit "]"
8989 , return $ emit "("
90− , return $ emit $ intercalate ", " (("const boxed& " <>) <$> args)
90+ , return $ emit $ intercalate ", " (renderArg <$> args)
9191 , return $ emit ") -> boxed "
9292 , prettyPrintCpp' body
9393 ]
@@ -169,7 +169,7 @@ literals = mkPattern' match'
169169 match (Function _ name args ret) = mconcat <$> sequence
170170 [ return $ emit $ if name == (Just tcoLoop) then "[&]" else "[=]"
171171 , return $ emit "("
172− , return $ emit $ intercalate ", " (("const boxed& " <>) <$> args)
172+ , return $ emit $ intercalate ", " (renderArg <$> args)
173173 , return $ emit ") -> boxed "
174174 , prettyPrintCpp' ret
175175 ]
@@ -454,7 +454,7 @@ interfaceSource mn exports foreigns =
454454 (if null foreigns then "" else ("// Foreign values\n\nauto " <> foreignDict <> "() -> " <> dictType <> "&;\n\n")) <>
455455 (T.concat $ (\foreign' -> "inline auto " <>
456456 identToCpp foreign' <>
457− "() -> const boxed& { " <>
457+ "() -> " <> varDecl <> " { " <>
458458 dispatchOnceBegin <>
459459 foreignDict <> "().at(" <>
460460 (stringLiteral . mkString $ runIdent foreign') <> "); " <>
@@ -475,8 +475,8 @@ implFooterSource :: Text -> [Ident] -> Text
475475implFooterSource mn foreigns =
476476 "\n\n" <>
477477 (if null foreigns then "" else ("auto " <> foreignDict <> "() -> " <> dictType <> "& {\n" <>
478− " static " <> dictType <> " _dict_;\n" <>
479− " return _dict_;\n" <>
478+ " static " <> dictType <> " $dict$;\n" <>
479+ " return $dict$;\n" <>
480480 "}\n\n")) <>
481481 "} // end namespace " <> mn <>
482482 "\n\n" <>
@@ -485,7 +485,7 @@ implFooterSource mn foreigns =
485485 mainSource :: Text
486486 mainSource = "\
487487 \int main(int argc, const char * argv[]) {\n\
488− \ Main::main()(nullptr);\n\
488+ \ Main::main()();\n\
489489 \ return 0;\n\
490490 \}\n\n\
491491 \"
@@ -508,11 +508,19 @@ bool = "bool"
508508string :: Text
509509string = "string"
510510
511+varDecl :: Text
512+varDecl = "const boxed&"
513+
514+renderArg :: Text -> Text
515+renderArg arg
516+ | arg == unusedName = varDecl
517+ | otherwise = varDecl <> " " <> arg
518+
511519foreignDict :: Text
512520foreignDict = "foreign"
513521
514522dispatchOnceBegin :: Text
515−dispatchOnceBegin = "static const boxed _value_ = "
523+dispatchOnceBegin = "static const boxed $value$ = "
516524
517525dispatchOnceEnd :: Text
518−dispatchOnceEnd = "return _value_;"
526+dispatchOnceEnd = "return $value$;"