Mostrando postagens com marcador English interview. Mostrar todas as postagens
Mostrando postagens com marcador English interview. Mostrar todas as postagens

Interview with Gavin Howard

Entrevista com Gavin Howard - O autor da linguagem bc do toybox

    Recently  I posted on my blog the release of bc 5.0 developed by Gavin Howard. I've been following Gavin's bc since November 2018 when it was anounced that he was developing it as a patch to toybox. I also posted on my Instagram that I was testing Gavin's bc even it was under peding version on toybox directory and since then good things have happened. One of them is that I met Gavin  Howard who gaves this awesome interview. I Hope you guys enjoy it :)

Gabriel: First of all I would like to thank you for accepting my invitation for an interview.

Gavin: Thank you for asking! Most people don't care about bc, so it's nice that someone cares for once. :)

Gabriel: Could you tell us a little bit about yourself? (Personal and professional life)

Gavin: I graduated from university a few years ago with a degree in computer science. Since then, I have worked on personal projects while struggling to get, and failing to keep, a job. My wife is the breadwinner. I'm pretty sure I fail to keep jobs because of a lack of social skills, so I would suggest to your audience that they develop those skills early, even if it's hard.

    Since losing my previous job, I have been working on bc and other software, but I'll talk more about that software later.

Gabriel: Why did you decide to develop bc?

Gavin: It just happened, really. I was unemployed, and someone asked me to build a parser for bc because he wanted to do the math library. I decided to do it for the resume experience.

    Well, once I got the parser built, he still wasn't done, so I decided to take the plunge and write the math myself. At that point, I had a fully working bc. Took me about a month.

    And then I have been perfecting it ever since. It's been about 3.5 years since I finished the original implementation.

Gabriel: What are the main differences between GNU bc and your bc?

Gavin: You mentioned that my bc does not have some bugs that GNU bc has. I would like to explain that.

    bc is a program that is standardized by POSIX. POSIX is a set of standards for operating systems that most follow, including Linux and Mac OSX (to some extent). POSIX doesn't just have standards for the operating system, though; some standards are for tools that the OS should have bundled with it. Among these are the `ls` command, the `mkdir` command, the `ln` command, and the `bc` command.

    The bc standard defines what bc is supposed to do and how it is supposed to behave. If you write your bc scripts to follow that standard exactly, you can pretty well count on your script running the same on any bc.

    The bugs in the GNU bc usually have to do with deviations from the bc standard. My bc does not deviate from the standard at all, except for extensions which can be disabled.

    Beyond that, my bc has *so* many more extensions than GNU bc, which yes, does have some extensions. The extensions that my bc has and GNU does not include:
  1. A seeded pseudo-random number generator that will generate numbers of arbitrary size. This allows users to generate pseudo-random numbers in Bash scripts.
  2. A way to input and output numbers in scientific and engineering notations.
  3. Assigning strings to variables, passing them to functions, and returning them from functions.
  4. Some extra builtin functions (abs(), modexp(), divmod(), asciify(), etc).
  5. Some extra operators for truncation, extension, and decimal (not bitwise) shifting.
  6. An extended math library with a lot (94, I think?) of extra useful math functions. (One function is not really useful except for the library itself.)
  7. A command-line flag to make it easier to handle globals (ibase, obase, and scale).
Gabriel: In a particular conversation, you told me your bc was adopted by the toybox team to help toybox to build the Linux kernel. Can you give us more details about it?

Gavin: In the Linux kernel, there is a header that needs to be generated during the build. This header (include/generated/timeconst.h, see https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/Kbuild#L16) has the constants for how many milliseconds the kernel should wait before interrupting a process. Basically, this header defines the size of time slices (https://en.wikipedia.org/wiki/Preemption_(computing)#Time_slice).

    In order to generate this header, the kernel has an option (CONFIG_HZ, found under "Processor type and features" -> "Timer Frequency") that sets the number of times per second that the kernel should preempt processes. This frequency needs to be converted into the number of milliseconds per slice. Originally, the script to do this was in bc. It was changed to Perl because of GNU bc bugs, but switched back after those bugs could be worked around or fixed. (See https://github.com/torvalds/linux/commit/70730bca1331fc50c3caacaea00439de1325bd6e). The script is kernel/time/timeconst.bc (https://github.com/torvalds/linux/blob/5bfc75d92/kernel/time/timeconst.bc).

    The reason bc is used rather than Perl is because bc is a POSIX standard, so Linux can expect that it will exist on the system, whereas Perl needs to be explicitly installed. That said, the Linux timeconst.bc script uses some GNU extensions, which defeats the purpose.

    At the time, toybox had no bc, and so, by itself, was not enough to build the Linux kernel, and because the Linux timeconst.bc script used GNU extensions, it really needed the GNU bc. With the addition of my bc, which has all of the GNU bc extensions, toybox became able to build Linux without any other external utilities, a remarkable achievement for the toybox author.

bc code inside the Linux kernel
bc code inside the Linux kernel


Gabriel: In my personal opnion, bc is a good way to learn programming. Do you agree?

Gavin: I heavily disagree, actually. The reason is because there are numerous pitfalls and traps you can fall into when writing bc code. (See https://git.yzena.com/gavin/bc/src/branch/master/manuals/development.md#lib-bc-1). These snares include:
  1. There are three global variables (ibase, obase, and scale) that control how bc behaves. These globals must be handled properly at all times.
  2. The globals (ibase, obase, and scale) must be saved before being modified in a function, and must be restored before returning from a function.
  3. If constants are used, ibase must be explicitly set by the function (and restored before return) or else the constants will be interpreted in the wrong way.
  4. If the function prints a number to stdout, obase must be explicitly set by the function (and restored before return) before printing, or the number will be printed in an unexpected way.
  5. All variables local to the function must be in an auto statement at the beginning of the function, including arrays. If you don't do this, the variables or arrays are assumed to be global, and so the global versions will be used/changed. However, "global" in this sense is *also* misleading. Say you have a function that has the variable `a` as a local variable (it appears in the auto statement). If it calls a function that accesses a "global" `a`, the `a` that it accesses is not the true global `a`, but the version of `a` in the function that called it! This is in the standard, so I can't change it, but it is something to be aware of.
  6. The last snare is only for code that wants to be portable to any bc: you cannot use *any* extensions.
    That last one deserves a closer look. POSIX standard bc is bare bones; it has hardly anything at all! These are some of the things it does not have:
  1. Names longer than 1 character.
  2. `else` clauses for `if` statements.
  3. The `continue` keyword (though it does have `break`).
  4. An easy way of printing strings with escape characters (the `print` keyword in my bc).
  5. Return statements *without* parentheses.
  6. You can't use comparison operators outside `if` statements or loop conditions.
  7. You can only use *1* comparison operator per `if` statement and loop, so no `&&` or `||` operators!
  8. Technically, array parameters are somewhat limited as well.
  9. Strings can only be printed and nothing else done with or to them.
(For everything that my bc that POSIX standard bc does not, see https://git.yzena.com/gavin/bc/src/branch/master/src/data.c#L265-L283).

    That said, if you need to write a math script in a language with arbitrary-precision numbers, and Python won't work (Python has fairly good support for arbitrary-precision math), then bc might be what you need.

    Also, my bc removes a lot of those limitations. It removes number 2 (if you use the -g command-line option) and basically all of the limitations under number 6. The rest cannot be eliminated because they are inherent to the design of bc.

Gabriel: How can people contribute to your projects?

Gavin: I actually do not take contributions besides bug reports. My current project is at https://git.yzena.com/Yzena/Yc , and I explain my policy at https://git.yzena.com/Yzena/Yc#open-source-not-open-contribution.

    The part that is *not* written down is that, if I write everything myself, I can make sure that the software is of such high quality that I am willing to take liability for it. That's my current aim: to write useful software and accept liability for it, for a price. I figure that if I cannot get a job, I can make a job for myself by selling software and accepting liability for it.

 (But even if I sell software, it will still be open source! I will only sell liability protection, not the software itself.)

 That said, if you find a bug in bc and fix it, I'll still probably take your fix; I'm never going to accept liability for bc. You are also welcome to submit bug reports for *all* of my software.

Gabriel: Final consideration?

Gavin: I am currently writing a programming language, a build system, and a version control system. If any of your audience would like to contact me with comments or questions about those three things, or about my bc, they are welcome to. I'll try to respond as quickly as possible. To find my email address, go to https://gavinhoward.com/contact/.

Thank you for listening to me!

Bate bola com os desenvolvedores do Atelier (pt01)

Atelier is an open source program that allows you to control your 3D printer.
Atelier is an open source program that allows you to control your 3D printer. 
Faz a pipoca e vem conferir esse bate papo bem bacana com os mantenedores do projeto Atelier (primeira parte).


--------------- VARTROY TECNOLOGIA ---------------

Soluções inovadoras com Linux, software livre e open source
- Consultoria - Terceirização de TI - Suporte e Manutenção - Desenvolvimento de sites - Tradução, revisão e versão - Interpretação
- Ribeirão Preto / SP

Resumo do Tux (10/09/2016 - Fox n Forests)


 Essa foi uma semana especial em que mostrei dois casos de financiamento coletivo. Um de sucesso que foi o jogo Fox n Forests (que ainda será lançado em Setembro do ano que vem) desenvolvido pela empresa de Munique Bonus Level Entertainment e outro que não bem sucedido (o que foi uma pena) que foi o jogo Dark Drive desenvolvido pela empresa Tailandeza Rambutaan.






 Na quinta, eu tive o privilégio de trazer Rupert, o diretor e idealizador de Fox n Forests aqui no canal :-)



E na sexta feira eu mostrei toda a equipe:



Bom, hoje eu trouxe sobre o jogo que me lembra muito Super Metroido. Lamento muito não ter dado certo.



Marcadores

A pior história sobre Linux que já ouvi (5) A.I (1) ambiente gráfico (19) AMD (14) analise (9) Andriod (14) android (5) artigo (5) aws (1) bc (15) benchmark (3) BSDs (27) btrfs (30) bugs (1) Caixa de Ferramentas do UNIX (19) canto do Diego Lins (2) certificações Linux (7) Código Fonte (53) comandos (24) comp (1) compressores (5) container (6) CPU (19) criptografia (4) crowdfunding (9) cursos (24) daemons (13) Debian (31) desenvolvimento (80) desktop (19) DevOps (3) DevSecOps (3) dic (1) Dica de leitura (86) dica DLins (2) dicas do Flávio (27) Dicas TechWarn (1) diet libc (1) diocast (1) dioliunx (3) distribuições Linux (13) Docker (11) DragonflyBSD (20) ead Diolinux (2) edição de vídeo (5) EMMI Linux (4) emuladores (5) endless (5) English interview (3) Enless OS (2) entrevista (17) espaço aberto (82) evento (6) facebook (1) Fedora (10) filesystem (75) financiamento coletivo (2) fork (4) fox n forests (4) FreeBSD (20) Funtoo Linux (13) games (90) gerenciadores de pacotes (3) GOG (3) google (8) gpu (3) hardware (101) hash (1) helenos (3) I.A (1) init system (8) Intel (15) IoT (1) ispconfig (1) jogos (36) kde (1) kernel (134) lançamento (60) leis (1) LFCS (1) licenças (8) Linus (16) linus torvalds (2) Linux (194) linux foundation (3) linux para leigos (1) live (5) LPI (8) LTS (1) machine learning (1) matemática (4) mesa redonda (27) microsoft (6) microst (1) muito além do GNU (146) não viva de boatos (9) navegadores (3) NetBSD (7) novatec (17) novidades (1) nuvem (1) o meu ambiente de trabalho (3) off-topic (12) open source (82) OpenBSD (5) OpenShift (1) os vários sabores de Linux (39) padrim (2) palestras e eventos (5) partições (6) pentest (8) pipewire (1) processadores (27) professor Augusto Manzano (11) Programação (60) promoção (1) propagandas com Linux (8) Red Hat (21) redes (3) resenha nerd (4) Resumo da Semana do Dlins (2) resumo do Tux (19) retrospectiva Linux (1) risc-V (1) runlevel (2) segurança digital (19) servidores (1) shell (3) sistema operacional (22) smartphones (3) Software livre e de código aberto (150) sorteio (3) Steam (9) Steam no Linux (7) supercomputadores (4) suse (7) systemd (7) terminal (83) terminal de comandos (11) toca do tux (1) toybox (23) tutorial (6) Tux (3) unboxing (7) UNIX (16) UNIX Toolbox (14) vartroy (1) vga (1) vulnerabilidade (4) wayland (5) whatsapp (1) Windows Subsystem for Linux (2) wine (14) WoT (1) ZFS (13) zsh (2)