Retired Adobe Engineer and Exiv2 Maintainer

Hello, Happy Crystal People

I was intrigued to learn about Crystal on today’s CodeProject Newsfeed. “A pythonic compiled language”. This has to be safer than C++, and I look forward to learning more.

I retired in 2022 from maintaining Exiv2 and am very happy that Team Exiv2 are active and made a new release in January. https://exiv2.org

In 2021, to prepare for my Exiv2 escape, I wrote a book Image Metadata and Exiv2 Architecture to document the engineering of the metadata engine. The book is illustrated with a 4000-line C++ metadata debugger. I will explore an implementation in Crystal. Image Metadata and Exiv2 Architecture

11 Likes

Hey, welcome to the community! :wave:

I hope you’ll have good experiences with Crystal. It actually as a couple nice features for reading binary data.

What is it that sparked your interest? “A pythonic compiled language” - is that an article? Could you share a link?

Thank You, @straight-shoota. I’m happy to be here.

Here’s the link: If Python is too slow for you, Crystal could be your savior. The elegance of python in native/compiled code is appealing.

The code in the book is tvisitor.cpp. I’ve thought of porting it to Python or Rust. I’ll think about Crystal.

The book also contains a file dump utility (dmpf.cpp).

539 rmills@rmillsm1:~/gnu/crystall $ dmpf
usage: dmpf [-]+[key=value]+ path+
options: bs=1 count=0 dryrun=0 endian=0 hex=1 skip=0 start=0 verbose=0 width=0
540 rmills@rmillsm1:~/gnu/crystall $

This little beast combines dd and od in only 278 lines of C++. I’ll learn about crystal by porting that.

7 Likes

Pah! Crystal is much more elegant than that old snake! :smiley:

4 Likes

Old? I first met C++ in 1986. I look forward to Crystal Charms.

2 Likes

Sweet Euphonium!

1 Like

It is very annoying the way the author of that article keep attacking puts method, when it is a standard c function.

3 Likes

4 Likes

I didn’t read the article. It’s the subject that interested me. He only mentions puts a couple of times.

For sure, I like the smell of crystal. I installed on macOS and created a project. Is there documentation on how to work with a ‘project’?

504 rmills@rmillsm1:~/gnu/crystal/hello $ ls -l
total 24
-rw-r--r--+ 1 rmills  staff  1090 10 Feb 18:07 LICENSE
-rw-r--r--+ 1 rmills  staff   595 10 Feb 18:07 README.md
-rw-r--r--+ 1 rmills  staff   147 10 Feb 18:07 shard.yml
drwxr-xr-x+ 4 rmills  staff   128 10 Feb 18:07 spec
drwxr-xr-x+ 7 rmills  staff   224 10 Feb 18:18 src
505 rmills@rmillsm1:~/gnu/crystal/hello $ cd ..
506 rmills@rmillsm1:~/gnu/crystal $ crystal build hello
Error: file 'hello' does not exist
507 rmills@rmillsm1:~/gnu/crystal $ cd hello/src
508 rmills@rmillsm1:~/gnu/crystal/hello/src $ crystal run hello_goodbye.cr 
509 rmills@rmillsm1:~/gnu/crystal/hello/src $ ls *.cr
all_my_cli.cr		hello_goodbye.cr	twist_and_shout.cr
hello.cr		help.cr
510 rmills@rmillsm1:~/gnu/crystal/hello/src $ crystal run hello.cr
Hello World!
511 rmills@rmillsm1:~/gnu/crystal/hello/src $ 

I’m going to build from source to get the interpreter:

512 rmills@rmillsm1:~/gnu/crystal/hello/src $ crystal i
Crystal was compiled without interpreter support
513 rmills@rmillsm1:~/gnu/crystal/hello/src $ 

There’s documentation dealing with the project. Using the Compiler - Crystal

you can build the compiler by following the steps from Install From sources - The Crystal Programming Language

keep in mind that by default you will just build a compiler without interpreter support, so to make sure you need to type make compiler interpreter=1 release=1 instead of make.

Thank You @npm. I’m in great shape. I have crystal working correctly (including $ crystal play and $ crystal i. Your release people have done a perfect job so I can run from the macOS pkg and/or install with brew. I’ve documented this for others: Issue compiling on M1 Pro MacBook. · Issue #12046 · crystal-lang/crystal · GitHub

When I first used crystal, $ crystal i claimed “crystal not build with …” and I thought I would have to build crystal. Building crystal requires llvm-config, which Apple does not provide. So, I attempted to build llvm with horrible consequences, including consuming my 50Gbyte of free storage.

It all ends happily. I’m delighted by your support and encouragement. It’s fun to hang out with everybody. Oddly, I’m still searching for motivation to write some code in crystal—something for next week.