Hiển thị các bài đăng có nhãn programming-languages. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn programming-languages. Hiển thị tất cả bài đăng

Thứ Ba, 30 tháng 10, 2018

D language front-end merged with GCC 9; some sample D programs

By Vasudev Ram


The D Language Front-End Merged Into GCC 9 (phoronix.com)

HN thread about it.

D is a nice language, and fast both to compile and run. It has a wide range of features, but one can get started with it without learning all of them. It's fast both to compile and to run. Dev time is fast too.

I commented on the HN thread above too, giving a list of some of my own small D language programs (mainly command-line utilities) that can serve as a quick introduction to some of the different things that you can do with D.

I've reproduced the links to those D programs for the convenience of my readers, below:

"Here are a handful of D programs that use various features of the language and some of its libraries, on my blog. Most of them are simple command-line utilities to do various things. Readers may find them of use to get a flavor of the language and to know some of the kinds of things it can be used for."

A few of the posts are about interviews with D language people too.

Don't miss the interview where the creators or key people from the C++, Rust, D and Go languages talk to each other on a panel about some of the pros and cons of their respective languages - and the incident near the end of the video, involving Bjarne Stroustrup (the LangNext video below).

Here are those D-related posts:

Porting the text pager from Python to D (DLang)

Simple parallel processing in D with std.parallelism

Video: Interview: GoingNative 6: Walter Bright and Andrei Alexandrescu - D Programming Language

Using std.datetime.StopWatch to time sections of D code

Read from CSV with D, write to PDF with Python

Command line D utility - find files matching a pattern under a directory

min_fgrep: minimal fgrep command in D

num_cores: find number of cores in your PC's processor

Calling a simple C function from D - strcmp

Component programming in D - DDJ article by Walter Bright

Func-y D + Python pipeline to generate PDF

Interview: Ruminations on D: Walter Bright, DLang creator

file_sizes utility in D: print sizes of all files under a directory tree

Video: C++, Rust, D and Go: Panel at LangNext '14

deltildefiles: D language utility to recursively delete vim backup files

[DLang]: A simple file download utility in D

Getting CPU info with D (the D language)


- Vasudev Ram - Online Python training and consulting

I conduct online courses on Python programming, Unix / Linux commands and shell scripting and SQL programming and database design, with course material and personal coaching sessions.

The course details and testimonials are here.

Contact me for details of course content, terms and schedule.

DPD: Digital Publishing for Ebooks and Downloads.

Learning Linux? Hit the ground running with my vi quickstart tutorial. I wrote it for two Windows system administrator friends who were given charge of Unix systems. They said it made it easy for them to start using vi on Unix.

Check out WP Engine, powerful WordPress hosting.

Creating or want to create online products for sale? Check out ConvertKit, email marketing for online creators.

Own a piece of Americana: Jacob Bromwell: Legendary American Cookware

Teachable: feature-packed course creation platform, with unlimited video, courses and students.

See my posts about: Python * DLang * xtopdf

Check out my My ActiveState Code recipes (over 90 of them, mostly on Python)

Follow me on:


Thứ Sáu, 14 tháng 4, 2017

Andrei Alexandrescu's AMA on IAmA reddit (C++ and D are some topics)

By Vasudev Ram

Just saw this today via a link while browsing articles about DLang (the D Language):

Andrei Alexandrescu's AMA on IAmA reddit

It starts off like this:

[ I am a member of Facebook's HHVM team, a C++ and D pundit, and a Machine Learning guy. Ask me anything!

Background:
My name is Andrei Alexandrescu. I've been a Research Scientist at Facebook for almost four years, during which I've worked on various projects mainly around Machine Learning and systems programming. In January I joined the HHVM project, which aims at improving the productivity and performance of PHP on Facebook's server infrastructure.
I've also written a couple of books: Modern C++ Design, C++ Coding Standards (together with Herb Sutter), and The D Programming Language, as well as some papers and articles. Some of my talks are on video (this is the most recent).
Looking forward to answering your questions! ]

I read part of the thread (so far); there are some interesting questions and answers in it, about both C++ and D (and maybe some other stuff I haven't seen yet). One such interesting point was this, where, in reply to a question, he says he likes to brag about inventing D's scope statement :-)

Some excerpts below:

[
chefox 17 points 3 years ago
What's the biggest lesson learned from D that you wish other languages would apply?

andralex 36 points 3 years ago
The scope statement. It's rare that I enjoy bragging about something, but I do like to brag that I invented a new control flow statement (which is awesome because they're so few!).
I think many languages implement some form of deferred execution, but most miss the point - Lisp's with-open-file, Java's try/finally, Go's defer, C#'s using are all sorely wanting.
]

Another one:

[ ... We have had an incredible time with compile-time evaluation in D for years, and I'm glad C++ "stole" that idea. ... ]

Another:

[
miotatsu 29 points 3 years ago
what has been your happiest moment with programming?

andralex 54 points 3 years ago

I remember moments when I'd run a little program again and again with slightly different inputs just to revel in the joy of having done the proper incantations that make the machine do this and that and the other, like a clumsy but loyal genie. I mentioned I wrote this floppy disk formatter - it gave me a lot of joy to be able to tell it the complicated sequence of things I wanted to get done, to see how it ended up carving magnetized trenches into the physical world.

]

Comment about the floppy driver formatter:
[
My first application was a keyboard driver in assembler. It used only 782 bytes of memory as opposed to the default of 4KB. I wrote it because I only had little RAM available.
My second application was a floppy disk formatter written in C++. It formatted 5.25'' floppies to 1.6 MB. Floppies were expensive and I couldn't afford many. Of course, they didn't retain information very well, but long-term retention wasn't at the top of my list :o).
]

About functional programming:
[
amzeratul 11 points 3 years ago
Lots of functional programming features are now available in languages such as C++ and D - what do you think are some of the functional features that we'll see incorporated in languages such as those over the next decade or two?

andralex[S] 17 points 3 years ago
There's talk about purity in C++, but beyond that I'm not sure whether there are plans for major FP-related additions.
Of the usual suspects present in FP languages, D notably misses pattern matching. It is in tension with OOP-style (first match vs. best match), and I'm not sure whether or not it's a fundamental feature of functional style. There are no plans to add such at this time.
]

[
p0nce 9 points 3 years ago
How much more productive do you think D can really be if adopted at C++ scale? Me and other enthusiasts I know are heavily biased by our positive solo experiences with it.

andralex[S] 10 points 3 years ago
Productivity and its variations are difficult to measure. Build speeds alone, at one order of magnitude speedup, are dramatic enough to exert a change of paradigm. For example, many people say dynamic languages are productive because they have the "right" execution model - save file, hit Refresh. If actual times for a compiled language drop to the point of offering the same model, I think a whole category of perceptions would change.
One thing I noticed with D is its "plasticity". Once you have a body of code that works in C++, the natural tendency is to be conservative about changing it: unit testing is tenuous, subtle failure scenarios upon changes are legion, not to mention build times etc. In D, it's a lot easier to mold and remold designs are you go because you know you wont be penalized for it.
]

[
Ingrater 10 points 3 years ago
Following the developement of D you get the feeling that way to many developement resources are spend on new features instead of finishing existing ones. For example a lot of work has been put into user defined attributes while other features are unfinished, unstable or not even usable (alias this, shared, export, structs). Whats your opinion on this?

andralex[S] 14 points 3 years ago
I agree that we should focus more on completing, streamlining, and using what we've got. This is happening already - it's been a while since quality has been at the top of our list, and the positive PR has been visibly improving.
Now that we have more resources there is some amount of parallel work we could do, and the mixed blessing with volunteer work is people work on what they find interesting, not necessarily what's best to do at the moment. This has been a challenge, but at the same time a good problem to have.
]

[
jfernand 10 points 3 years ago
Andralex,
No question to ask, but the comment that I carry the D language book with me at all times, and re-read it like it is a novel; I love every line of code I write in D, and the language and its design choices make me a better programmer the more I understand them. D simply makes sense, and it is a shame that it does not have more traction... I am an seasoned C/C++/Perl programmer, and D is in many ways the epitome of the history of languages, in my opinion.

andralex[S] 9 points 3 years ago
Thank you! No worry, we'll figure out the traction issue :o).
]

There's a lot more to the thread, check it out. Here it is again:

Andrei Alexandrescu's AMA on IAmA reddit



- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers



Thứ Sáu, 7 tháng 4, 2017

The reference D compiler is now open source (dlang.org)

By Vasudev Ram


Just saw this discussion on HN:

DMD, the reference D compiler is now open source (dlang.org)

It is about this news about the D language:

dmd Backend converted to Boost License

I read part of the discussion, and also commented. As often happens, though the original post is about the change in the licensing of the back=end of the DMD compiler (Digital Mars D), the thread devolved (partly at least) into a discussion of the pros and cons of D versus some other languages, and that kind of thread is often interesting.

Updating the post to add:

- Link to this post on programming.reddit.com about the news:

The Official D Compiler Is Now Free (as in "freedom")

- As user bionsuba says there:

[ bionsuba[S] 30 points 4 hours ago
The front end as been Boost licensed for several years now. But now the backend has been relicensed thanks to Symantec giving their permission.
This has big implications for the language as a whole, as the compiler can now be included in Linux package managers. Meaning, D programs can be distributed on those same package managers. There's also the possibility that DMD can become part of the default packages on a distro! ]

And Andrei Alexandrescu (of Modern C++ Design fame), who now works with Walter Bright on the D language, adds:

[ andralex 16 points 3 hours ago
We will discuss more details and implications of the impact of open sourcing the compiler at DConf in Berlin in May. Registration is open! ]

Update 2 to add:

I'm putting below, an Ask HN thread that I had started some months ago. It got some interesting replies:

Ask HN: What are you using D (language) for?

The replies give some examples of non-trivial things that D can be used for.

Update 3 to add:

As Walter Bright say here, it's the #1 story on HN at the moment (and for a while now).

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers



Thứ Ba, 20 tháng 12, 2016

[Video] Interview: All Things D (programming language) - A Conversation with Andrei Alexandrescu

By Vasudev Ram


This is a video about the D language that I watched recently, which I found informative and interesting:

All Things D (programming language) - A Conversation with Andrei Alexandrescu

It's an interview of Andrei, I think by the same interviewer (who is not seen in this video) who did the interview of people from the D, Rust, Go and C++ teams, at the LangNext '14 event, the video of which I posted about here earlier:

Video: C++, Rust, D and Go: Panel at LangNext '14

Andrei talks about the past, features and future of D. The video is also embedded below.



- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Managed WordPress Hosting by FlyWheel



Thứ Bảy, 26 tháng 11, 2016

Video: Interview: GoingNative 6: Walter Bright and Andrei Alexandrescu - D Programming Language

By Vasudev Ram


I watched this video (from 2013) a few days ago:

GoingNative 6: Walter Bright and Andrei Alexandrescu - D Programming Language

Going Native [1] is a tech event, and I guess 6 refers to the 6th year or edition of it. I first saw this video on Channel 9, one of Microsoft's technology sites. That site has multiple links to the video, including downloadable, in different qualities, so you may want to check out getting it from there. [2]

[1] There seems to be rising interest in "native" (programming) languages these days (before the rise of "scripting" languages, all languages were native, i.e. they ran, after compilation, on the "metal" (i.e. the CPU), not on a language VM or interpreter, and we just called them languages, no fancy-shmancy names, ha ha :). Part of the reason for the rise in interest, as mentioned in the video, is that we are entering (or have entered) a world of multi-core and concurrency, and due to Moore's law ending (?) Anyway, native languages like D, Go and Rust are picking up these days, whatever the reason. I've used native languages like Pascal and C a lot at work earlier, so I welcome this return of greater interest in native languages, though I'm not stopping using languages like Python anytime soon either.

[2] And to download the video at the command line, check out youtube-dl, a YouTube downloader in Python. Yes, downloading a video about native languages with a tool written in a scripting language - go figure :)

The video shows an interviewer talking to both Walter Bright and Andrei Alexandrescu. Walter, who developed the first native C++ compiler, is the original creator of the D programming language and Andrei, who was a C++ expert and book author, joined him some years later to help in developing the language. The interview was somewhat wide-ranging and a bit long, and quite interesting. Many aspects of the language and the plans and in-progress work for it were talked about.

The video is also embedded below.



Happy holidays to my readers.

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Black Flyday at Flywheel Wordpress Managed Hosting - get 3 months free on the annual plan.

Subscribe to my blog by email

My ActiveState recipes



Thứ Sáu, 28 tháng 10, 2016

Red-Lang: Live-coding of a clock demo, EVE-style

By Vasudev Ram



Clock live-coding image attribution

This is cool. I was just reading this HN thread:

Eve: Programming designed for humans (witheve.com)

which, BTW, is at the top of the HN front page at the time of this writing, and is about a new programming language called Eve from Chris Granger (and maybe others).

The Eve web site.

The home page of the Eve site says: [ Eve is a programming language and IDE based on years of research into building a human-first programming platform. From code embedded in documents to a language without order, it presents an alternative take on what programming could be - one that focuses on us instead of the machine. ]

Chris Granger may be known to some as the person behind Light Table, an innovative "open source IDE that lets you modify running programs and embed anything from websites to games", that was also discussed quite a bit on HN some time ago. I'm guessing Eve builds upon Light Table, for the IDE part of it.

[ Update: Chris's HN profile says: Co-founder of Kodowa, the company behind Eve and Light Table. YC alum. Ex-Microsoft Program Manager for C# and VB in Visual Studio. Chris also says in this comment on the HN thread, that the language part of Eve (it has other parts too) is a variant of datalog. ]

I had not checked out Light Table but I had briefly checked out Noir (another project by Chris), a micro-framework that allows you to rapidly develop web sites in Clojure, and had liked what I saw of it.

Anyway, in the HN thread about Eve, someone posted a link to a demo of live-coding a digital clock, using the Red language, which I had also checked out some months ago. I found Red and its goals interesting; reducing the complexity of modern software development is a big goal, another is being cross-platform (to desktop and server and mobile) and being a full-stack language - that last point, a bit like the D language - i.e. from being able to use assembly (Red may not supports that, but D does), all the way up to high levels of modeling power - but Red does have a lower level language, which Red is in fact built upon, called Red/System, which is supposed to be at the conceptual level of C - but with Red-style syntax). Red is at a somewhat early stage of development - v0.6 or so, but usable. I could even compile a simple Red program to an EXE and run the EXE - it was quite small too. Yes, RED has both an interpreter and a compiler - and like REBOL, the whole Red package is astonishingly small in size.

Red is a sort of successor to REBOL, but by a different person / team. I had played around with REBOL some years earlier and liked it too.

Here is the clock live-coding demo in Red - the drawing of the clock actually updates on the screen, live, as the code for the clock is being written. This works due to some language features of Red, including, as they say on that page:

[ Yes, livecoding (using native widgets!) in Red can be that simple. As you can see, there's no built-in "livecode" widget or feature, it's an emergent behavior resulting from the combination of existing Red features, homoiconicity being the most fundamental. ]

Interestingly, as the Wikipedia article (linked in the preceding sentence) says, assembly language (at least for systems using Von Neumann architecture) can also be considered to be homoiconic - because both code and data are just bytes in memory.

The image at the top of the post is a screenshot I took, of when the live-coding, and hence the (iterative and exploratory) drawing of the clock was in progress.

The image below is another screenshot taken after the clock was fully drawn. If you load that page in your browser, you can see the whole thing happening.


- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes

Managed WordPress Hosting by FlyWheel



Thứ Hai, 19 tháng 9, 2016

Calling a simple C function from D - strcmp

By Vasudev Ram


D => C

It's quite useful to be able to communicate between modules of code written in different languages, or, in other words, to be able to call code in one language from code in another language. Some of the reasons why it is useful, are:

- some functions that you need may already be written in different languages, so it may be quicker to be able to call cross-language from function f1 in language L1 to function f2 in language L2, than to write both f1 and f2 in L1 (or in L2) from scratch;

- the function f2 that you need may not be as easy to write in language L1 as it is in language L2 (or you don't have people who can do it in L1 right now);

- f2 may run faster when written in L2 than in L1;

- etc.

I was looking into how to call C code from D code. One source of information is this page on the D site (from the section on the language spec):

Interfacing to C

Here is an example of calling a simple C function, strcmp from the standard C library, from a D program, adapted from information on that page:
/*
File: call_strcmp.d
Purpose: Show how to call a simple C string function like strcmp from D.
Author: Vasudev Ram
Copyright 2016 Vasudev Ram
Web site: https://vasudevram.github.io
Blog: http://jugad2.blogspot.com
*/

extern (C) int strcmp(const char* s, const char* t);

import std.stdio;
import std.string;

int use_strcmp(char[] s)
{
// Use toStringz to convert s to a C-style NULL-terminated string.
return strcmp(std.string.toStringz(s), "mango");
}

void main(string[] args)
{
foreach(s; ["apple", "mango", "pear"])
{
// Use dup to convert the immutable string s to a char[] so
// it can be passed to use_strcmp.
writeln("Compare \"", s.dup, "\" to \"mango\": ", use_strcmp(s.dup));
}
}
I compiled it with DMD (the Digital Mars D compiler):
$ dmd call_strcmp.d
and ran it:
$ call_strcmp
Compare "apple" to "mango": -1
Compare "mango" to "mango": 0
Compare "pear" to "mango": 1
The output shows that the C function strcmp does get called from the D program, and gives the right results, -1, 0, and 1, for the cases where the first argument was less than, equal to, or greater than the second argument (in sort order), respectively.

Of course, not all kinds of calls from D to C are going to be as easy as this (see the Interfacing reference linked above), but its nice that the easy things are easy (as the Perl folks say :).

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes



Programming Languages Beacon (what large apps written in what languages)

By Vasudev Ram

Java C# Python C++ PHP ASM C


The Programming Languages Beacon (PLB) is an interesting site that I came across today, via this comment on John D. Cook's blog. (The comment is by Cook himself, in reply to another comment on his post).

The PLB page has a big table showing the main programming language(s) that many large well-known software products, such as operating systems, browsers, office suites, and others, are written in.

Some of the products mentioned in the table: Windows, Linux, Mac OS, HP-UX, iOS, Android, KDE, MS Office, LibreOffice, Oracle, MySQL, Hadoop, Firefox, Safari, ...

No prizes for guessing what language(s) the majority of the products listed are written in :)

The beacon site is maintained by Vincent Lextrait.

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes

Managed WordPress Hosting by FlyWheel



Thứ Tư, 7 tháng 9, 2016

"Please don't assume Lisp is only useful for Animation and Graphics, AI, Bioinformatics, B2B and E-Commerce, Data Mining, ...


By Vasudev Ram


"Please don't assume Lisp is only useful for Animation and Graphics,


AI, Bioinformatics, B2B and E-Commerce,


Data Mining, EDA/Semiconductor applications,


Expert Systems, Finance,


Intelligent Agents, Knowledge Management, Mechanical CAD, Modeling and Simulation, Natural Language, Optimization, Research, Risk Analysis, Scheduling, Telecom,


and Web Authoring just because these are the only things they happened to list." --Kent Pitman

One could say somewhat the same about Python ...

Image attributions:

Utah teapot

Shopping cart icon

Semiconductor

Dollar

Telecom

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes



Thứ Ba, 30 tháng 8, 2016

Interview: Ruminations on D: Walter Bright, DLang creator


By Vasudev Ram

I read this interview yesterday:

Ruminations on D: An Interview with Walter Bright (creator of the D programming language).

(Walter Bright (Wikipedia))

The interview also links to this talk between Walter and Andrei Alexandrescu, of Modern C++ fame, who joined Walter to work on D (after working at Facebook for some time)) about a D project, warp (a C++ preprocessor), that Walter did for Facebook; the talk is about the D benefits Walter found while working on the project (such as the ease of changing the data structures to try different approaches, and how the ranges and the algorithms that operate upon them are somewhat decoupled).

(Andrei Alexandrescu (Wikipedia))

HN thread about the interview.

You can also check out this video, about the creators or key team members of 4 languages, C++, D, Golang and Rust, talking at LangNext '14:

Video: C++, Rust, D and Go: Panel at LangNext '14

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes




Thứ Năm, 4 tháng 8, 2016

The D Language Playground site

By Vasudev Ram


The D language playground site:


is a web site (created somewhat recently, IIRC), where you can write or paste in a chunk of D code into a text box, click Run, and it will run it on their server, and send back the results to be displayed. It also has a tour of the language, and you can go from one example to another, and just run, or modify and run, each of them. So the same site serves both as an online sandbox to experiment with D language snippets, and as an interactive tutorial for D. In both these ways it is similar to the Go language playground/tour site. Either or both are worth checking out, if you are interested in those languages.

- Vasudev Ram - Online Python training and consulting




My Python posts     Subscribe to my blog by email

My ActiveState recipes