How close does shen get to my dreams ?

5 views
Skip to first unread message

Marc Weber

unread,
1:23 PM (5 hours ago) 1:23 PM
to Shen
Hello,

I have had some strange fun cases in the past:

1) packaeg management:
  Find latest version of combination of dicikam and miardb running on linux,osx,windows
  to share photos on an external disk

2) but similar happens in programming:

  Share a type between API and frontend.

  My vision is like

  [ language features ] => {
     common_typing_space = new_typing_space() # see end
     c_backend( sourcedir = .., common_typing_space)
     js_frontend( sourcedir = .., common_typing_space)
     build_vite_like_experience_with_resumable_qwik_city_like_components(c_backend, js_frontend)
  }


  which then can do fun stuff like


  migrations

    mihgration1(db: <schema>){
      db.add_table
    }
    => returns schema with table added


  rows = db.query('SELECT .. FROM ..')
  -> rows is typed

  print(row.new)  # field new doesn't exist yet, so compiler should suggest creating a schema ..

  Now queries can be very complex like the WHERE part depending on 40+ form input details with nested queries.
  And if its admin the select part might have 5 additional fields. And TS like languages break down on:

  if is_admin
    print(rows[0].field_fetched_if_is_admin_1)

TS is fast to type. But not close to C/Rust speed.
So Ideally I'd like to use LISP like to define the code, verify all links are fine.
And then unroll by injecting compile time stuff to get flat C like fast code with type annotations
so that compilers can optimize.

So basically something which is like Wordpress, but with a compliation and
verification step.

Shen already can be run on different targets.
Now if you limit yourself to:
  - arrays
  - hashes
  - stirngs numbers
  - true/false/nil
  - functions(..args)
  - maybe even simple classes
you often can even compile down to the target lanuage.
without interpreter if you use .+ for floats + for thus enforce type by methods
(Zig macro like)

Most web development is
  - read POST/GET
  - find route
  - query datbase
  - format result as HTML
And arrays and hashes can do that easily.

The resumable Qwik City case is fun because it is the first framework I found
which allows the production system to learn how much of frontend code to push
how fast for what user. Whether it is a sane idea or just serve a huge
webassembly binary blob today is a different question. But for online shopping
experience sending HTML only first is an advantage.

So I am looking for a framework which can not only compile to a target,
but extract pieces from universal code for SSR and frontend interactivity (like
qwik City).

Rust (lapce) vs vscode show that lines dynamic vs compiled should blur.
And shen I think got this right, too.

But when targeting GPU,NPU or mobile (OpenXr) what I am actually looking for is

c_types = cimport("vulkan.h")
// zig like but lisp doesn't have compile time, right ?
// So the compilation phase kinda finds out what is right ?

(S :: c_types.VKStruct) => (a :: S, h b :: S) => {
  // now when interpreted the type info S tells the struct offsets
  // when compiled down to C the offsets can be baked into the machine code
  // so this is a function with comopile time parameter
}

The real issue is I laways ended up
- needing optimize and scripting in compiled lanugages
- needing macro at typing space or compile space (eg TS)

So I was always unable to express what I had in mind.

eg TS way to map types is yet another suggar which cannot be used in the JS language.
Why not ?


Haskell, C, Rust (?) mostly require you to deifne types


struct Row { name, age }

Array<Row> (){
  rows = sql("...")
}


Rust has somethyngi like anonymous structs or such. But not sure they made it
official. Diesel or so is using it.

typical code is

interface I { .. }
class A extends I
class B extends I

But if you want to tell A and B shoul have same interface,
this would be enough:

#if target=js
  class X extends ^T<random> {
    bar()
  }
#end
#if target=php
  class X extends ^T<random> {
    foo()
  }
end

where ^T references a global type hole to be filled and compared against
So when the PHP compiler looks at X it will find a type hole, fill it with foo.
And when the JS backend looks at it it will find out: Should have foo, but
found bar.

So type matching could be enforced without having to define a common
truth ahead of time as you can avoid defining the return type when querying a
DB.

I think touring completness is not a problem.
There is no amonut of rules you can setup to prevent people from shooting
themselves into their feet. But I'd be perfectly fine with having fast
iterativie dev workflow with a lot of proofs or types >being worked on<
while I change a small number ..


So what I am looking for is

[ features ] => interpreter/compiler
integrating musltiple languaes so that *ONE* lanugage can be a shell, backend frontend
depending on how I configure it. like esperanto starting with "hello" but
allowing to add more features if I need them.

Because eg going from Ruby to Rust means rewrite.
And that's what I hate. Rewriting a module for speeed ?
Restricting a type or optimizing it for production ?
No problem.

Reinventing the world and having 5+ lanugages compile to GPU with shared types
taichi native vs taichi.js
Rust -> hatching
and the many others .. and always having to fit int othe boxes and frames to
workaround (Yes, OO wrappers for SQL ! looking at you, too) and how does this
or that language do this in particular is technical unpredictable depth
I'd like to minimize in the future.

So I wonder should I use Lisp or shen or such to get started, what would I be
missing ?

rows[0]. -> LSP completions working how is it different from a proof
rows[0].name exists ?

One is a directed flow of types (from sql string .. to function return value ..
to its usage). The other one is a wholistic view lets proof property for
whatever we got here. One could be a strategy for the other.

Every language I looked at Rust, JS, go, .. all can use eg OpenXR.
But turning the XML function definitions into the target languages
has been implemented the many times with minor bugs and issues.

So I'd love to fix my problems at language level once.
But I am trying to build a typing system which can integrate PHP, TS and others
and tell this is an array of ints .. so you should be fine.

Or maybe derive the types of an API (function return types) and create a spec.

Maybe even $a = "() => 7"; String<JsEvaledType<() => number>>
Thus have PHP know the JS type if the string got evaled.

x = decode(encode(z)) // having x preserve the type.

etc.

So which of my dreams do already exist and which need to be written ?
Reply all
Reply to author
Forward
0 new messages