I apologize, I don't have specific feedback beyond a vague sense of mild confusion or constructive ideas on how to make it better, hopefully someone else brighter than I can take a crack at it?
/var/lib/vv/bld/stockapp/__stock.o.c
(so here "stock" is the application name and there's "stock.v" file).For example, when you see this Vely statement in stock.v (which obviously obtains input parameters from either GET or POST request):
input-param stock_name
this is line 9 in stock.v.All you need to do is look for:
#line 9 "stock.v"
in the generated code (which is
/var/lib/vv/bld/stock/__stock.o.c), in this case it's: char *stock_name = vey_get_input_param (vey_get_config()->ctx.req, "stock_name")
So in this case, it's just one line of C code. In other cases, it may be many lines. For example, Vely statement which apparently runs the INSERT SQL query: run-query#add_data@db = "insert into stock (stock_name, stock_price) vaues ('%s', '%s') on duplicate key update stock_price='%s'" : stock_name, stock_price, stock_price
This is on line 12 in stock.v, and you can simply search for #line 12 "stock.v"
in /var/lib/vv/bld/stock/__stock.o.c file. In this case, the generated code looks like: VV_UNUSED (_column_count_add_data);
vely_get_config()->ctx.db->ind_current_db=0;
static void *_sql_prep_add_data_stock_v_649 = NULL;
_is_input_used_add_data[0]=1;
_is_input_used_add_data[1]=1;
_is_input_used_add_data[2]=1;
add_data = "insert into stock (stock_name, stock_price) values ('%s', '%s') on duplicate key update stock_price='%s'";
const char *fname_loc_add_data = "stock.v";
num lnum_add_data = 12;
vely_location (&fname_loc_add_data, &lnum_add_data, 1);
vely_make_SQL (&_sql_buf_add_data, 3, add_data , _is_input_used_add_data[0]==1 ? (stock_name) : NULL , _is_input_used_add_data[1]==1 ? (stock_price) : NULL , _is_input_used_add_data[2]==1 ? (stock_price) : NULL );
if (_qry_executed_add_data == 1) {vely_report_error("Query [add_data] has executed the second time; if you want to execute the same query twice in a row without a loop-query, use different queries with the same query text (or variable) if that is your intention, file [stock.v], line number [12] ");}
_qry_executed_add_data = 1;
vely_execute_SQL (_sql_buf_add_data, &_arow_add_data, (const char**)&_err_add_data, (const char**)&_errm_add_data, 0, 1, 0, &_sql_prep_add_data_stock_v_649, _sql_paramcount_add_data, _sql_params_add_data);
_nrow_add_data=0;
vely_db_free_result ();
vely_free (_sql_buf_add_data);
so about 16 ines of code.This way you can see what actual C code is generated for any Vely code.
And you can also step through this code in gdb by using --c-lines option in vv.
There is a lot going on in your big example, and I wouldn't want to have to download and run it first to get a rough mental model of what's happening.
And Vely generates a request dispatcher, which takes the "req" input parameter, which is really the name of the source Vely file. So if "req=mycode", then the function "void mycode()" will execute and it must always be defined in source file mycode.v. This makes it easy to always find the code, and quickly grasp what application does.
Unlike C Makefile, you don't have to write a Makefile. Whatever .v files you have in your source code directory will be automatically picked up and made into an application.
The generated code can and will change. It tries to do the best job of doing what is instructed to do. So if you say:
web-call "http://website.com" response resp response-code rc status len post files "file1"="uploadtest", "file23"="fileup4"
then it will generate the C code to effectively POST a form to website.com that sends two local files to that server, and will get you the response code and status back. You can do this by using CURL library, but it will take quite a bit of C coding to do this. And there are many different combinations and things you can do, and the code gets generated to do it quickly and efficiently.The same goes for exec-program, run-query, send-file, encrypt-data etc etc. All this things you can program yourself in C, but these statements are flexible and will let you quickly and safely do those things. More like "what I want to do" rather than "how I want to do it". Though, like I said, you can examine the generated C code to see exactly how it's done.
The "hello world" tutorial is good for this. And if you do decide to try Vely, I would say try
https://vely.dev/123_hello_world.html
first, as it can't get any simpler. It's designed to give you an application in minutes. You'll get a command-line executable, and you will be running your own application server that can take input from Apache or Nginx via FastCGI. The example though uses FastCGI command line client so you don't have to do anything beyond what's already included in Vely package.I'm not sure of custom BNF per generating command. I notice they're mostly order independent, which makes it a little easier to learn, but what's the advantage over c syntax? Is it roughly that pointers etc are impossible. Maybe a c-esque syntax would be more learnable
How does the existing syntax compose, i.e. can the user run away with writing tcl-style scripts
If you don't get a lot of feedback, I would guess it is inpart due to custom syntax being an entry barrier to understanding
I don't know, I think html is easy, so people want power with php. On the other hand for an audience that is using c, by the time I'm doing that, does Vely's custom syntax give me more than a set of convenient c library calls... such as https://kristaps.bsd.lv/kcgi/
In any case, I like the apis, and aim, and I think the premise has legs
Vely has FastCGI built in by default (you can start FastCGI server in seconds with vv/vf), and the output statements (such as @ or p-out) do output to the web (i.e. to the Apache or Nginx reverse proxy) by default.
So you could say in terms of functionality, kcgi is built into Vely transparently.
In terms of additional functionality beyond kcgi, Vely offers
- web constructs (getting input parameters from GET/POST, uploading files, sending files to client with send-file, cookie handling, output to web etc.),
- safer and easier string manipulation,
- database access (mariadb, mysql, postgresql, sqlite) with prepared statements and persistent connections,
- regex (match-pattern),
- exec-program for executing programs,
- file operations,
- encryption/encoding/hashing.
I agree there's a learning curve. I can't say how would people see that, though the idea is to be easier than a traditional API, simply on the account of writing a single statement instead of say 5-10 C API calls.
Vely is meant to be more human-readable than APIs; it leans more declarative than API. Each statement typically does what a number of C API calls would do, so the idea is to save time by saying what you need done rather than placing a number of API calls. At the same time, it's safer because it handles all the details and has a memory garbage collector.
For instance, web-call does all kinds of GET and POST calls. run-query does SQL queries. write-string composes complex strings. Etc.
Vely is also a thin framework. You can fire up FastCGI application server in minutes, and use the same program to run a command-line program.
Vely is also a thin framework that mostly helps with building apps by not having to write Makefile, it will pickup any .v files you got.
And it will generate a dispatcher for requests.
But the framework doesn't do much, only the essentials, and that's by design. After all, C is all about flexibility, and that stays.
hopefully not although Slor HN could be a variant of Show HN but for roasting.
This reminds me of Bjarne Stroustrup's original implementation of C++ which was also transpiled to C. That was known as "Cfront" compiler at the time.
I think of Vely as staying simple, declarative, and C all the way for performance reasons. More of a collection of practical things you'd want to do.
code {
font-family: 'DejaVu Sans Mono';
}
in your CSS to code {
font-family: 'DejaVu Sans Mono', monospace;
}
For people without DejaVu Sans Mono installed (or for browsers doing a good job at defeating font fingerprinting), which would be most people, the code sample is rendered in the default proportional font, which is very ugly. font-family: monospace;
and that's it.People have been mucking about with typography since Gutenberg's day and they're not going to stop now.
I'm personally 'font blind', but I don't have a problem with people being creative and making aesthetic choices.
_ANY_ article about CSS and client side javascript however.. go go go! :)
Vely is an embedded programming language with C as a host language. It's precompiled into C, creating a native executable.
Vely empowers C with rich features, simplicity and enhanced safety. It is general-purpose and well-suited for web applications.
Use Vely to rapidly develop high-performance and low-footprint applications