deno runner
import { flush, js_string, setMemory, spectest } from "../.mooncakes/mizchi/js_io/mod.ts";
type Instance = {
fire: (fid: number) => void;
};
pub trait ToJson { | |
write_json_string(Self, Buffer) -> Unit | |
} | |
fn ToJson::write_json_string(self : Int, buf : Buffer) -> Unit { | |
buf.write_string(self.to_string()) | |
} | |
fn ToJson::write_json_string(self : Bool, buf : Buffer) -> Unit { | |
buf.write_string(self.to_string()) |
String JS <=> Moonbit
struct MyCtx {
result: String
mut cur: Int
input: @vec.Vec[Int]
}
pub fn app() -> MyCtx {
/* | |
analyze reserved properties from bundled dts for terser | |
$ pnpm tsm analyze.ts src/*.{ts, tsx} -i src/index.ts | |
{ | |
"reservedProperties": [ | |
"result", | |
"value", | |
"pubTypeKey", | |
"ikey", |
This is translation of https://zenn.dev/mizchi/articles/introduce-moonbit from japanese
Recently, I came across a language called MoonBit, and the more I looked into it, the more I liked it, so I'd like to introduce it.
import prettier from "prettier/standalone"; | |
import produce from "immer"; | |
import { parse } from "svelte/compiler"; | |
import type { Ast } from "svelte/types/compiler/interfaces"; | |
// @ts-ignore | |
import * as sveltePlugin from "prettier-plugin-svelte"; | |
function printTemplate(ast: Ast) { | |
const overridePlugin = produce(sveltePlugin, (d: any) => { | |
d.parsers.svelte.parse = () => { |
放送で紹介する用。書きかけです。
ちょっと伸びたのでさらに追記。これは元々自分の勉強がてら書いていたもので、これを書く過程でどうしても自分の理解では説明できないところがあり koba789 に依頼してペアプロをしてもらった、という流れがあります。その結果が次の動画です。
生放送の流れを円滑にするために資料を公開しましたが、この記事は未完成で、あとでさらに整理して別途記事にまとめるつもりです
この記事は https://medium.com/@ryardley/react-hooks-not-magic-just-arrays-cd4f1857236e の日本語訳です。途中で力尽きて雑な翻訳になってる箇所がいくつかあります。
私は、新しい Hooks の API の "magic" な挙動に悩んでいる人が結構いると聞いています。なのでこの構文の提案が、少なくとも表面的なレベルではどう動いているか、解説してみようと思います。