sweet.js VS marshal.ts

Compare sweet.js vs marshal.ts and see what are their differences.

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
sweet.js marshal.ts
12 30
4,580 3,088
0.0% 1.5%
0.0 9.6
over 6 years ago 1 day ago
JavaScript TypeScript
BSD 2-clause "Simplified" License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

sweet.js

Posts with mentions or reviews of sweet.js. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-06-30.
  • JavaScript Macros in Bun
    2 projects | news.ycombinator.com | 30 Jun 2023
    I was ready to be excited from the title, but was utterly disappointed :(

    IMO these aren’t macros in the Lisp-sense of the word (or Rust, or even C); yeah they run code at compile time, but that’s where the common ends.

    Macros should be able to apply syntactic transformation on the code. Lisp is famous for allowing that by representing code as lists. Rust has a compiler-level API to give tokens and run arbitrary code, then spit new tokens out. C macros operate on the tokens level, so with enough magic you can transform code to the shape you want.

    This… isn’t any of that.

    A pretty good example (and something I’m still sad that it didn’t take off) of macros in JS is Sweet.js[0]. Babel macros[1] are a bit higher level, where macros require the input to already be a valid AST, but that’s also cool.

    This… I’d say it’s more of a build-time code execution feature, not a macro feature.

    [0]: https://www.sweetjs.org/

    1 project | /r/node | 19 Jun 2023
    Macros I'd expect to be able to be able to expand at compile time to more code to reduce boilerplate, something like SweetJS.
  • Angular Signals: What? Why? and How? (Classy explanation of what we know as writables.)
    1 project | /r/sveltejs | 26 Jun 2023
    But yes, I'll tone down my appreciation for writables in this sub, I'll confine my tangents to svelte. A kind of a shame I'd love to talk about using https://www.sweetjs.org/ to make the $ autosubscription work outside of svelte, and the like. But holy off-topic Batman!
  • Sweet.js - Hygienic Macros for JavaScript (Macros allow you to sweeten the syntax of JavaScript and craft the language you always wanted)
    1 project | /r/javascript | 9 Feb 2023
  • Interesting... Macros for JavaScript?
    1 project | news.ycombinator.com | 9 Feb 2023
  • Pipe Operator (|>) For JavaScript
    9 projects | news.ycombinator.com | 20 Jan 2023
    Mozilla created SweetJS over a decade ago[0]. It added hygenic macros to JS and I'm sure everyone on the TC39 committee is familiar with it.

    There's a lot to like about it, but macros in such a complicated language as JS are hard to get right. They'd also potentially lead to huge fracturing in the JS ecosystem with different factions writing their own, incompatible macro-based languages.

    Look at JSX for an example. It's actually a subset of a real standard (E4X -- actually implemented in Firefox for a long time), but just one relatively small syntax addition has added complexity elsewhere.

    For example, `const foo = (x:T) => x` is valid Typescript for a generic arrow function, but is an error if your file is using JSX.

    I like the idea of macros, but I suspect they made the right call here.

    [0] https://www.sweetjs.org/

  • Ultra-minimal JSON schemas with TypeScript inference
    11 projects | news.ycombinator.com | 27 Jul 2022
    Sweetjs is unfortunately dead [0] for like 5 years now.

    It also doesn't have any typescript awareness which is required to build this kind of functionality - you want to have static type introspection available in macros so you can generate code based on provided types.

    [0] https://github.com/sweet-js/sweet-core/graphs/contributors

  • Equivalent to macros, ifdef and enums from other programming language?
    2 projects | /r/learnjavascript | 28 May 2022
    None of these are supported natively by JavaScript. Macros and ifdefs you could get with your own build step using things like sweetjs or ifdef-loader for webpack. Enums are in a similar boat with TypeScript supporting enums out of the box. But there's also a (very early) proposal to add enums natively to JavaScript as well.
  • What are some reasons to use metaprogramming?
    3 projects | /r/functionalprogramming | 16 May 2022
    TS doesn’t have monadic do notation, which is something that I want very badly. This would be easy to add to JavaScript with Sweet.js macros, but there’s no equivalent tool for TypeScript. I expect that extending this to TypeScript would be very difficult.
  • SICP: JavaScript Edition available for pre-order
    2 projects | news.ycombinator.com | 21 Jan 2022
    > If forEach is not to be used

    That source is simply incorrect. forEach is perfectly fine to use as long as you realize what is happening. It iterates an array where each thing is a function that returns a promise. Of course the results aren't what they expect.

    ES5 array additions suffer from being a little too early (though later stuff wouldn't exist otherwise, so...). They are designed to deal with holey arrays (arrays with indexes missing). This is extremely uncommon today, but was decently common once upon a time. They were also created before the iterator protocol.

    The real fix is to design iterator versions that can handle things like async generator functions.

    > it should be deprecated and removed from the language in a timely manner.

    NOTHING can be removed from the language once added. Doing that would break all the older websites that depend on it (technically, a few minor breaks happened after they tested millions of sites and couldn't find anything that was adversely affected). At best, they can block older features from newer features. For example, using class syntax or a bunch of other ES6 language structures automatically makes your code shift into "use strict" mode.

    I hope they introduce a "use strict 2" variant that strips away more of the undesirable features than the current "use strict" does.

    > Since Javascript is based on C syntax, it should have the preprocessor that the birthplace of C saw it fit for that language not to be without.

    That pre-processor was a source of untold nightmares. Direct injection leads to bugs. If someone is going that route, full-blown macros are the only answer. There is a full-blown macro system Mozilla created a few years ago, but it's not very popular.

    https://www.sweetjs.org/

    There also exist some C-style pre-processors for babel too, but they should be avoided because lisp's gensym is a critical feature that they and C both lack.

marshal.ts

Posts with mentions or reviews of marshal.ts. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-15.
  • Deepkit Enterprise TypeScript Framework
    1 project | news.ycombinator.com | 9 Dec 2023
  • We use TypeScript not based on preference, but because we want to make money
    3 projects | news.ycombinator.com | 15 Sep 2023
    zod or yup gets you quite a bit of the way there in practice - when you would reach for a Typescript type, making it in zod instead is more verbose but gives that runtime layer.

    But for those who actually want full-stack non-stripped runtime type reflection based on Typescript syntax alone... https://deepkit.io/ - https://deepkit.io/blog/introducing-deepkit-framework - is a really promising and cool project.

    It patches the typescript compiler (which pointedly considers runtime type information out of scope) with its own type compiler that emits a bespoke bytecode that is executed in a bespoke VM to communicate runtime type information to both server and client as needed. https://docs.deepkit.io/english/runtime-types.html

    And from that baseline, there are very cool things you can do like an ORM entirely based on type annotations https://docs.deepkit.io/english/database.html or strongly-typed RPCs https://docs.deepkit.io/english/rpc.html .

    It's very much in the alpha stage, but it's really well thought out - there's a tremendous degree of care the developer is taking towards code cleanliness and developer experience. I'm torn between wishing this project to have a fully funded team and take the world by storm, vs. "letting them cook" so to speak and seeing the developer experience unfold organically. Either way, it's a breath of fresh air into the Typescript ecosystem!

  • Is there a TS backend development environment similar to what I have for the frontend?
    3 projects | /r/typescript | 8 Jul 2023
  • TypeScript please give us types
    10 projects | news.ycombinator.com | 7 Jul 2023
    Deepkit (listed in the article) is a fascinating project and really deserves to be more popular.

    It also demonstrates that what is being asked for is actually practical.

    https://deepkit.io/

  • Bebop introduces JSON-Over-Bebop for fast runtime type validation of raw JSON in Typescript; faster than Zod and other alternatives
    3 projects | /r/typescript | 27 Jun 2023
    Checkout deepkit One of the things it has is a really fast BSON parser, that is faster than the JSON one to my understanding. Interesting work with TS types too
  • Show HN: Magma – Multiplayer AI for Artists
    1 project | news.ycombinator.com | 31 May 2023
    Hello HN community! I’m one of the founders of Magma, a multiplayer art platform. You might recall our earlier post (https://news.ycombinator.com/item?id=30869131), and today we’re sharing a significant update with our artist-focused, multiplayer AI assistant, a first in the realm of collaborative creative tools. Hope you’ll like it!

    See how it works in this YouTube video: https://www.youtube.com/watch?v=ZESJfjwxLjk. For in-depth understanding, here’s our documentation (https://help.magma.com/en/articles/6711598-beta-ai-assistant) and our AI manifesto (https://magma.com/aimanifesto) which is a guiding document for us.

    We're inviting you to get hands-on with this new feature. Join any of these canvases (up to 50 live contributors each): https://magm.ai/qnss, https://magm.ai/ei74, https://magm.ai/38mr, https://magm.ai/z1ti, https://magm.ai/zdub, https://magm.ai/ed93, https://magm.ai/1l84, https://magm.ai/xvu5, https://magm.ai/gd9j, https://magm.ai/pu6e. All of these canvases have extra feature flags enabled but if you’d like to go beyond them, feel free to join our beta community https://magm.ai/magma-beta-artspace-invite

    Our artist-first approach is rooted in our belief that human creativity should remain the heart of artistry. With our AI handling routine tasks, artists can focus on true creativity. Importantly, our AI preserves artists' copyright as it provides a clear distinction between human-generated and AI-generated content.

    Beyond just art, Magma is a powerful tool for game dev and animation, offering powerful design & review tools for all stages of the creative process. Our Slack/GDrive-like workspaces (we call them Artspaces) expose API and even shell tools. One can even render any artwork in the terminal. :)

    Technically speaking, our collaborative drawing engine is powered by Typescript, Node.JS, WebGL, with a hint of WebAssembly for hand-optimized performance that even Chromebooks can handle. The backend also leverages a high performance Typescript Deepkit Framework https://deepkit.io

    Our AI assistant runs on a worker-based architecture akin to Gitlab CI workers, currently leveraging Stable Diffusion 2.1. Future developments will allow connecting your own AI worker, training custom models within Magma, and plugging in API keys from other AI backends.

    Feedback, questions, thoughts? Let's discuss! Happy creating with a helping hand of AI!

    P.S. A shout-out to the HN community, our last post here helped us connect with an amazing technical angel investor who has made significant contributions. Looking forward to more such productive connections!

  • Why nodejs engineers prefer express over nestjs? although nestjs forces good practice and proper architecture and it seems to be a right choice for complex and enterprise applications like asp.net and Spring. What are the limitations of nestjs compared to express?
    3 projects | /r/node | 26 May 2023
    Take a look at restfuncs then. Or deepkit or telefunc.
  • Runtime TypeScript types change everything
    5 projects | /r/typescript | 13 May 2023
    Both work out of the box very well with Deepkit. You can either construct your own types in runtime or mix TS types with runtime information. See for example https://github.com/deepkit/deepkit-framework/blob/master/packages/framework/src/crud.ts where this is done
  • IS there a way to generate Swagger model schemas from interfaces
    2 projects | /r/typescript | 18 Apr 2023
    Yes, you can directly use the interfaces and types as is with Deepkit (https://deepkit.io) and the library deepkit-openapi. You get also full route documentation if you use the deepkit/http router where you can use interfaces and type aliases plus validation thpes for route parameters (query parameters, body, etc). It still in alpha, but approaches soon beta.
  • Hegel – An advanced static type checker for JavaScript
    12 projects | news.ycombinator.com | 11 Oct 2022
    https://deepkit.io/ may be of interest to you! It deeply patches the TS type compiler to make all types visible at runtime, enabling a lot of annotation-style workflows and dependency injection possible completely within the type annotation system: https://docs.deepkit.io/english/runtime-types.html

    Previous discussion: https://news.ycombinator.com/item?id=31663298 - it's downright mindblowing that all this seems to be the work of primarily a single developer.

    For a less intrusive solution, https://github.com/jquense/yup is a great library to reach for whenever you're defining the shape of a network-transmitted object and don't want to introduce compilation stages.

What are some alternatives?

When comparing sweet.js and marshal.ts you can also consider the following projects:

Zepcode - ⚗️ Zeplin extension that generates Swift snippets from colors, fonts, and layers

ts-jackson - A typescript library to deserialize and serialize json into classes. You can use different path pattern to resolve deeply nested structures. Every path pattern provided by lodash/get|set object is supported. Check out src/examples as a reference.

ts-morph - TypeScript Compiler API wrapper for static analysis and programmatic code changes.

Quarkus - Quarkus: Supersonic Subatomic Java.

typescript-transformer-handbook - 📘 A comprehensive handbook on how to create transformers for TypeScript with code examples

new-error - Production-grade error creation and serialization library designed for Typescript

medium-editor - Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

polka - A micro web server so fast, it'll make you dance! :dancers:

ace - Ace (Ajax.org Cloud9 Editor)

FizzBuzz Enterprise Edition - FizzBuzz Enterprise Edition is a no-nonsense implementation of FizzBuzz made by serious businessmen for serious business purposes.

CodeMirror - In-browser code editor (version 5, legacy)

Koa - Expressive middleware for node.js using ES2017 async functions