How to create a directory of library functions?

Just a quick fact check: I’ve been looking for a “current date & time” that’s independent of where in the world the calling system is. Programming tools DEVLAB script pic (hour, etc.) is unsuitable since it reports local date & time. I suspect Programming tools DEVLAB script pic 2 will do, though - it appears to report milliseconds since midnight of Jan. 1, 1970 in Greenwich Mean Time (or UTC probably, which boils down to almost the same). Am I supposing correctly?

It is true that it does report milliseconds since midnight of Jan. 1, 1970 in Greenwich Mean Time, but it's still local time, or at least, the time set on your computer.

@ego-lay_atman-bay: Thanks for responding. Do you mean: if someone were to manipulate the time as kept on their computer, the result would be changed accordingly?

Let me explain the background of my question
I’m thinking of starting a directory of Snap! library functions, and inviting Snap! users who would like to share their libraries of interesting functions with others, to submit (meta-)data about their work (such as:
Programming tools DEVLAB script pic 3
for libraries, and

for individual functions; and perhaps some additional data items like version number, a quality indicator, or how often an entry has appeared in a search result).

The timestamp would have to be universal, so as not to confuse users and, possibly, registration software. Even if Programming tools DEVLAB script pic 2 could be manipulated in principle, I don’t expect any practical problems with that.

Libraries are essential to any serious real-life programming effort. So it’s quite logical for an educational language to introduce students to the concept. Library functions may take care of underlying tasks, such that a user can focus in what they set out for to achieve. Interested users may be taught and inspired by studying library functions’ implementations. The core language can be kept more or less compact, for easier learning and maintenance.

From what ‘I’ve understood, up till now most Snap! libraries were written by @bh (and, to a less extent, others from the Snap! team), with a few notable exceptions like SciSnap! and TuneScope. I’m sure there’s plenty of potential for expansion if other users are challenged to contribute their knowledge and creativity. But how will regular users find their work? That’s were the directory of library functions comes in: a single repository for any user looking for building blocks, and at the same time for experienced users to proudly share their inventions with others.

How will library functions be entered into the directory?
Ideally, a library “curator” - this is what I call the creator / manager of a library - could open a public Snap! project, and submit their (updated) data to a server, where a program would take care of the registration without moderator intervention.

Work packages
In order to make this work at least the following items would need to be taken care of:

  1. Writing basic registry software, including a restore mechanism to be activated after a crash;
  2. Building a facility for library curators to submit their data to a server running the register.
  3. Having the registry software + data hosted on a server (perhaps the Snap! team would help with this?)
  4. Writing software other users can apply to search for desired functions (this may be published as a regular Snap! project) + convincing the Snap! team to refer to this register from strategic spots;
  5. Authentication.

Request for suggestions
Suggestions (and other help) are welcome!
Thanks in advance!

Link to my first efforts
Directory of libraries (under construction)

If you are using a server, you could just send the data to the server, then the server set the timestamp. This makes the timestamps standardized.

I agree.

Huh? It has to be one or the other, and in fact it's UTC, precisely for the reason under discussion, namely, agreement across time zone boundaries.

No. I've written many of them, but the reason you think it's mostly me is that I've largely been in charge of curating them, e.g., arranging the grouping in the Libraries dialog's list. I am the main author of 11 of the current libraries.

As to your main point, we don't want to teach IT, such as how to build Windows-like registries, at the cost of a huge distraction for the (generally simple) things that the libraries are actually about. Yes, eventually professional programmers have to muck around in that pile of mud, but they can do that after they grow up and don't have any creativity or sense of fun left anyway because of the mortgage and managing their 401K.

What I'm trying to say is, the time in milliseconds block reports the time since jan 1st 1970, based on the time set on your computer. It doesn't follow the time zone set on your device.

Ok this'll explain better. I tested it out, and changing my time zone changed the result by a couple hours, at least on android. I have a feeling it's the same on a pc.

I hear what you're saying. For now it's a project I am interested in; perhaps some others will join eventually. I certainly wouldn't want to make anything complicated, much less in any way mandatory (btw idk what "Windows-like registries" means). If you don't want anything to do with it, that's cool.

Library functions may be mostly simple; in my experience even the official ones are not always easy to find - let alone those devised by other users.

Building on other people's work is actually key to achieving results almost anywhere, whether in e.g. science, government, business, construction ... or ICT.

  1. does this qualify as a rant? :wink:
  2. when a programmer (or anyone) has both a sizeable home loan and 401k of financial assets to manage, both issues can easily be solved at once; if the affected person can not see that, indeed it's fair to say they've lost all of their creativity!
  3. my impression is that, at least among non-staff contributors to this forum (who, admittedly, may be atypical of the user base as a whole), many (myself included) code in Snap! for fun, so as to escape mud and mortgage.

When you want to install an application on Linux or MacOS you just drag it into /usr/bin or /Applications respectively. But when you want to install it on Windows, you have to run an installer program that, in addition to putting the program itself somewhere (I actually forget where), has to store all sorts of metadata in other places. The main other place is the Registry, which is a file on your disk but you're not allowed to do regular file operations on it; instead there's an API for it. The Registry associates a name with the app that might not be its filename, and a bunch of other stuff I forget. (I had to learn this to make the installer for Berkeley Logo and then promptly forgot again.) What you're proposing isn't, of course, exactly the Windows Registry, but it's similar in spirit, I think.

I think you're not understanding what I meant. Of course users should know how to use the libraries and what libraries are available.

What about user-written libraries?

We haven't wanted to collect and disseminate most user-written libraries because either they do stuff we don't think are valuable for users other than the author to do or else they do things in ways that aren't the way we want users to learn, e.g., because the library does stuff in JS that's going to stop working soon because of a reorganization we're planning. In the rare cases when we do want to adopt a user-written library, we just put it in the official libraries collection, document it in the manual, etc. Typically such libraries are very small. For example, Catch Errors is a user-written library (although its code was moved into the PRIMITIVE block when we invented that for security reasons). All this is not to disparage users writing private libraries for their own purposes!

In a very few cases (bignums is an example) I've solicited a particular library from a particular user. Those become official libraries.

What I don't want users to have to do is learn administrative side tasks beyond just writing the code in order to get their library to work.

  1. Yes.
  2. When I was a youth, They always said "Don't pay off your mortgage!" Partly that's because I grew up in that golden era between World War II and the 2008 collapse of the economy, during which stock market performance actually beat the mortgage interest rate. That may no longer apply. But another reason for Their advice is that mortgage interest is tax-deductible, so the effective interest rate is lower than what you pay, and that's still true. Boy is this off-topic.
  3. See answer to number 1.

Ugh. Does that mean that measuring a time duration across the change from Daylight Savings Time to Standard Time gives a negative result?

That sounds like an Android misfeature, but it's a surprising one since Android is really Linux.

It also happens on ios. It's technically just up to the browser anyway.

For the directory of libraries I try to automate the registration process of functions as much as possible.
One of the function characteristics that's going to be registered is whether it employs user code in JavaScript.
So I wrote a JavaScript-detector for functions (blocks, scripts). It searches the definition of a function, plus definitions of custom functions called by the function, etc.
I wonder if anyone can find a flaw in it: (if there is one, it's not intentional!)

If you want to try it yourself, see the link in post #3.
BTW the function itself should of course have been a predicate, not a reporter. I already fixed that.

Paradoxically, since it searches code for JAVASCRIPT FUNCTION, the above JavaScript detector function will report itself containing JavaScript code (which is not true). Kurt Gödel would have liked it :smirk:.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.