I implemented support for property paths in my nat...
# devlog-together
m
I implemented support for property paths in my native compiler.
Copy code
scheme Hello 
{
   /hi/:p1 {
      get { 
	'hello: ',p1.
     }
   }
   -main:args
   {
        self waitOnPort: 8081 intValue.
   }
}
So that little test program can now be fully compiler to an ARM64 binary.
Copy code
]stc <http://SchemeDefHTTP.st|SchemeDefHTTP.st>
]file SchemeDefHTTP
SchemeDefHTTP: Mach-O 64-bit executable arm64
]./SchemeDefHTTP 
2023-07-30 10:16:36.680 SchemeDefHTTP[51040:2409943] will listen on port: 8081
From another shell:
Copy code
]curl  <http://localhost:8081/hi/Marcel>
hello: Marcel%
]wrk  <http://localhost:8081/hi/Marcel>
Running 10s test @ <http://localhost:8081/hi/Marcel>
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    57.33us   15.35us   1.13ms   80.91%
    Req/Sec    75.02k     3.81k   78.81k    95.54%
  1507905 requests in 10.10s, 198.45MB read
Requests/sec: 149295.29
Transfer/sec:     19.65MB
So more expressive than something like sinatra, but running at cool 140K requests/s. The dichotomy between expressiveness/comfort and performance is a false one, a bit like the one we used to have between user-friendly but crashy client-operating systems and solid but unfriendly server operating systems. Now my phone and my watch both run Unix.
k
Very interesting. Are your code samples in a shell? Hard to tell what you're typing and what's output.
m
Yeah, it’s a shell. If you want to be connective (architectural) you can’t live isolated in your custom environment. The ‘]’ is the prompt. wrk is a load tester. https://github.com/wg/wrk It is not limited to shell. Can compile to a framework or shared library and link against that or load it from just about anywhere.
k
I see. Is
stc
being developed in https://objective.st, or is it a new project?
m
stc
is a small script that drives the
ObjSTNative
framework, both are part of https://objective.st
Copy code
#!env st
#-<void>compile:source
framework:ObjSTNative load.
basename := source stringValue stringByDeletingPathExtension.
compiler := STNativeCompiler compiler.
compiled := compiler compileProcessToMachoO: (compiler compile: file:{source}).
objectFileName := basename , '.o'.
file:{objectFileName} := compiled.
compiler linkObjects: #[ basename ] toExecutable: basename inDir: nil additionalFrameworks:[ 'ObjectiveHttpd' ].
https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/blob/master/scripts/compile/stc https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/tree/master/ObjSTNative